packageurl-js icon indicating copy to clipboard operation
packageurl-js copied to clipboard

Fix issues #58 & #63

Open aniruth37 opened this issue 1 year ago • 6 comments

  • Fix issue https://github.com/package-url/packageurl-js/issues/58 - Incorrect parsing of PURLs beginning with pkg://
  • Fix issue https://github.com/package-url/packageurl-js/issues/63 - Incorrect parsing of PURL with leading '/' in namespace

Fix Description

  • strip /, // and /// as possible in pkg:/ or pkg:// or pkg:/// before passing into URL constructor
  • filter for non-empty items in namespaceComponents

aniruth37 avatar Dec 06 '23 09:12 aniruth37

@steven-esser Please review this

aniruth37 avatar Dec 13 '23 06:12 aniruth37

@matt-phylum please review this

aniruth37 avatar Feb 16 '24 14:02 aniruth37

@pombredanne, @steven-esser Can you please review this PR

aniruth37 avatar Mar 07 '24 04:03 aniruth37

I cannot reproduce #58 on master branch.

PackageURL.fromString('pkg://maven/org.apache.commons/io')

outputs

{
  "type": "maven",
  "name": "io",
  "namespace": "org.apache.commons",
  "version": null,
  "qualifiers": null,
  "subpath": null
}

jdalton avatar May 16 '24 12:05 jdalton

Are you sure? That is not the behavior I get on the master branch (commit aa6d185251e3ec4e6fbc80489374c5fede9ccca1).

> PackageURL.fromString('pkg://maven/org.apache.commons/io')
PackageURL {
  type: 'maven',
  name: 'io',
  namespace: null,
  version: null,
  qualifiers: null,
  subpath: null
}

matt-phylum avatar May 16 '24 12:05 matt-phylum

Ah, my bad!

jdalton avatar May 16 '24 17:05 jdalton

Closing as covered by https://github.com/package-url/packageurl-js/pull/71

jdalton avatar Aug 01 '24 17:08 jdalton