Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-30042

Reconcile component database from blob store task does not restore NPM assets which name starts with "/"

    Details

      Description

      SYMPTOM:

      After rolling back from the NewDB (PostgreSQL) to OrientDB, ran the "Reconcile component database from blob store" task, then it reported ERRORs for NPM assets:

      2021-11-29 11:46:17,939+1000 ERROR [quartz-10-thread-11] *SYSTEM com.sonatype.nexus.blobstore.restore.internal.orient.OrientNpmRestoreBlobStrategy - Error while restoring asset: blob store: default, repository: npm-proxy, path: /@types/lodash, blob name: /@types/lodash, blob id: ce1af3d0-d758-4b96-9ae8-17528dcf0e72
      java.lang.IllegalArgumentException: Non URL-safe name: /@types/lodash
      	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:219)
      	at com.sonatype.nexus.repository.npm.internal.NpmPackageId.<init>(NpmPackageId.java:54)
      	at com.sonatype.nexus.repository.npm.internal.NpmPackageId.parse(NpmPackageId.java:132)
      	at com.sonatype.nexus.repository.npm.internal.orient.NpmFacetImpl.findPackageRootAsset(NpmFacetImpl.java:91)
      	at com.sonatype.nexus.blobstore.restore.internal.orient.OrientNpmRestoreBlobStrategy.assetExists(OrientNpmRestoreBlobStrategy.java:104)
      ...

      REPRODUCE STEPS:

      1. Install new NXRM 3.36 and start (so that "default" blob store is empty)
      2. Copy the attached ce1af3d0-d758-4b96-9ae8-17528dcf0e72.* to default/contents/vol-33/chap-11/, for example:
        mkdir -p sonatype-work/nexus3/blobs/default/content/vol-33/chap-11
        cp ./ce1af3d0-d758-4b96-9ae8-17528dcf0e72.* sonatype-work/nexus3/blobs/default/content/vol-33/chap-11/
        
      3. Create "npm-proxy" repo with the remote URL https://registy.npmjs.org/ and with the "default" blob store
      4. Create "Reconcile component database from blob store" task and run against "default" blob store

      EXPECTED BEHAVIOUR:

      As NXRM3 should provide the way to reconcile assets, this should restore the files.

      ACTUAL BEHAVIOUR:

      It does not restore the asset and the task log reports "Error while restoring asset: ...".

      POTENTIAL CAUSE:

      com.sonatype.nexus.repository.npm.internal.NpmPackageId#parse decides the scope and the npm name based on the first matching "/", so that the name starts with "/" ended up generate an empty scope (eg: "") and the non modified name (eg: "/@types/lodash").

      NOTE:

      Also, reconciling NPM assets created by OrientDB may not work with Nexus + NewDB because org.sonatype.nexus.blobstore.restore.datastore.BaseRestoreBlobStrategy#restore always prepend "ASSET_PATH_PREFIX" into the assetPath.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              hosako Hajime Osako
              Last Updated By:
              Peter Lynch Peter Lynch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title