Default PortalUrl to https when no scheme is supplied #4

Open
hannah-vernon wants to merge 1 commit from fix/portalurl-missing-scheme into dev

What does this PR do?

A scheme-less -PortalUrl (for example mb-reports.corp.teranet.ca/reports) caused all three SSRS scripts to build a relative apiBase. [Uri].Host then returned empty (the blank "Server host :" line) and Invoke-RestMethod failed with "This operation is not supported for a relative URI."

This change normalizes -PortalUrl in Deploy-, Download-, and Remove-SsrsFolderItems.ps1: when the URL has no http(s) scheme, https:// is prepended. Explicit http:// / https:// URLs are unaffected. The README parameter tables now document the assumed scheme.

How was this tested?

  • Parse-validated all three scripts with [System.Management.Automation.Language.Parser]::ParseFile() - 0 errors each.
  • Verified normalization: mb-reports.corp.teranet.ca/reports becomes https://mb-reports.corp.teranet.ca/reports, [Uri].Host resolves to mb-reports.corp.teranet.ca, and apiBase is a valid absolute URI.

Checklist

  • Changes are focused - one logical change per PR
  • Documentation updated (README parameter tables)
  • No new dependencies
  • No commented-out code or debug leftovers
## What does this PR do? A scheme-less `-PortalUrl` (for example `mb-reports.corp.teranet.ca/reports`) caused all three SSRS scripts to build a relative `apiBase`. `[Uri].Host` then returned empty (the blank "Server host :" line) and `Invoke-RestMethod` failed with *"This operation is not supported for a relative URI."* This change normalizes `-PortalUrl` in `Deploy-`, `Download-`, and `Remove-SsrsFolderItems.ps1`: when the URL has no `http(s)` scheme, `https://` is prepended. Explicit `http://` / `https://` URLs are unaffected. The README parameter tables now document the assumed scheme. ## How was this tested? - Parse-validated all three scripts with `[System.Management.Automation.Language.Parser]::ParseFile()` - 0 errors each. - Verified normalization: `mb-reports.corp.teranet.ca/reports` becomes `https://mb-reports.corp.teranet.ca/reports`, `[Uri].Host` resolves to `mb-reports.corp.teranet.ca`, and `apiBase` is a valid absolute URI. ## Checklist - [x] Changes are focused - one logical change per PR - [x] Documentation updated (README parameter tables) - [x] No new dependencies - [x] No commented-out code or debug leftovers
A scheme-less -PortalUrl (e.g. mb-reports.corp.teranet.ca/reports) produced a
relative apiBase, so [Uri].Host returned empty and Invoke-RestMethod failed with
'This operation is not supported for a relative URI.'  All three SSRS scripts now
prepend https:// when the URL has no http(s) scheme, and README documents it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/portalurl-missing-scheme:fix/portalurl-missing-scheme
git switch fix/portalurl-missing-scheme
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hannah-vernon/ssrs-tools!4
No description provided.