Skip to content

Register-PSRepository - Invalid SourceLocation path for PS repository hosted on Artifactory #86

Open

Description

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

In version 2.2.6 Register-PSRepository adds unnecessary and invalid '/api/v2' at the end of SourceLocation when used with Artifactory hosted repository. My guess is that Artifactory returns 405 also for invalid repository paths.

The cause is a change in PowerShellGet’s URL validation:

  • Register-PSRepository probes the URL with /api/v2/ appended before trying the original.
  • Version 2.2.5 rejected HTTP 405 Method Not Allowed and falls back to the original URL.
  • Version 2.2.6 accepts 405, so it registers the incorrect appended URL.

Any workaround (other than downgrade to 2.2.5)?

Expected behavior

Name        InstallationPolicy   SourceLocation
----        ------------------   --------------
PSGallery   Untrusted            https://www.powershellgallery.com/api/v2
Foo         Trusted              https://artifactory.foo.com/artifactory/api/nuget/Foo

Actual behavior

Name        InstallationPolicy   SourceLocation
----        ------------------   --------------
PSGallery   Untrusted            https://www.powershellgallery.com/api/v2
Foo         Trusted              https://artifactory.foo.com/artifactory/api/nuget/Foo/api/v2/

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.7.0
PSEdition                      Core
GitCommitId                    7.7.0
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

2.2.6

Visuals

No response

Activity

  1. changed the title [-]Invalid SourceLocation path for PS repository hosted on Artifactory[/-] [+]Register-PSRepository - Invalid SourceLocation path for PS repository hosted on Artifactory[/+] on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions