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

/service/rest/v1/assets/{id} returns duplicate "lastDownloaded" attribute

    Details

    • Notability:
      3
    • InvestmentLayer:
      support-escalated
    • Aha Concept:
      non-concept

      Description

      SYMPTOM:

      Using RESTful API /service/rest/v1/assets/ (with "id" or without) returns two "lastDownloaded" with a correct datetime and "null".
      Having duplicate attributes affect to the script which parses this result.

      REPRODUCE STEPS:

      1. Install NXRM 3.39.0-01 or higher with OrientDB
      2. Create a raw-hosted repository, then upload / download:
        curl-D- -u 'admin:admin123' -T <(echo 'test') "${_NEXUS_URL%/}/repository/raw-hosted/test/test.txt";
        curl -u 'admin:admin123' -I "${_NEXUS_URL%/}/repository/raw-hosted/test/test.txt";
        
      1. Use the rest API:
        curl -u admin:admin123 "${_NEXUS_URL%/}/service/rest/v1/assets?repository=raw-hosted"
        

      NOTE: This issue can't be reproduced from http://localhost:8081/#admin/system/api page.

      EXPECTED BEHAVIOUR:

      No duplicate, as having duplicates is not valid for JSON.

      ACTUAL BEHAVIOUR:

      {
        "items" : [ {
          "downloadUrl" : "http://localhost:8081/repository/raw-hosted/test/test.txt",
          "path" : "test/test.txt",
          "id" : "cmF3LWhvc3RlZDo3NmQ3ZDdlNDE4NmEzOTBmNmZiMmUzZmRmZGQ1YTc4OQ",
          "repository" : "raw-hosted",
          "format" : "raw",
          "checksum" : {
            "sha1" : "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83",
            "md5" : "d8e8fca2dc0f896fd7cb4cb0031ba249"
          },
          "contentType" : "text/plain",
          "lastModified" : "2022-09-16T02:21:32.023+00:00",
          "lastDownloaded" : null,            <<<< Duplicate with "null"
          "uploader" : "admin",
          "uploaderIp" : "127.0.0.1",
          "fileSize" : 5,
          "blobCreated" : "2022-09-16T02:21:32.023+00:00",
          "lastDownloaded" : "2022-09-16T02:21:39.588+00:00"
        } ],
        "continuationToken" : null
      }
      

      This behaviour looks like introduced by NEXUS-31305 (org.sonatype.nexus.repository.rest.api.AssetXO#lastDownloaded is not used by Nexus + Orient).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              hosako Hajime Osako
              Last Updated By:
              Dirk Heinrichs Dirk Heinrichs
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title