Cli-microsoft365: Bug report: Retrieving modern page from the root site fails with an error

Created on 24 Jan 2020  路  4Comments  路  Source: pnp/cli-microsoft365

Description

Retrieving modern page from the root site fails with an error

Steps to reproduce

  1. In the root site of your tenant create a modern page
  2. Try to retrieve the page using o365 spo page get -u https://contoso.sharepoint.com -n page1

Expected result

Information about the page

Actual result

Error: serverRelativeUrl
Parameter name: Specified value is not supported for the serverRelativeUrl parameter.

Environment

macOS
zsh
CLI v2.6.0

bug work in progress

Most helpful comment

Yes that does make sense. I will start with adding the test to the page methods to see if they all fail and implement a fix on the correct places.

All 4 comments

Issue occurs on other environments as well. The problem is on line 42 where the code states:
args.options.webUrl.indexOf('/', 8). Doing that on the root URL returns a -1.

I suggest to create a reusable method to check return the relative URL and implement that in other methods as the getfilebyserverrelativeurl is used throughout the files actions (move, remove, checkout etc) and I assume that the same issue occurs there.

Feel free to assign to me :)

Thanks for the investigation @appieschot, issue assigned 馃憤馃徎

We (myself, @waldekmastykarz & @VelinGeorgiev) recently discussed that it would be a good idea to start adding tests that reproduce the bug as well as the code fixes. This way we can make sure that the bug is covered and it was also help increase the quality of our testing. Are you ok to look into providing that as well?

Yes that does make sense. I will start with adding the test to the page methods to see if they all fail and implement a fix on the correct places.

Great stuff @appieschot !

Was this page helpful?
0 / 5 - 0 ratings