• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • other
    • None
    • Jenkins 2.452.2, Artifactory Artifact Manager 108.veb_6efeb_c992b_, Copy Artifact 746.vd2a_674fb_4f6f, Artifactory Pro 7.71.10

      When using the Artifactory Artifact Manager plugin in combination with the Copy Artifact plugin (so artifacts are stored in Artifactory, and using the Copy Artifact plugin to copy them to another job), the copy can fail if the artifact name has special characters in it. See the below stacktrace:

      hudson.AbortException: Failed to download https://artifactory.example.com/artifactory/DevOpsTemp/jenkins/Test-Pipeline/36/artifacts/test#1.json to C:\j\workspace\Test-Pipeline\test#1.json, response: 404 , body: {
         "errors" : [ {
           "status" : 404,
           "message" : "File not found."
         } ]
       }
       	at io.jenkins.plugins.httpclient.RobustHTTPClient.lambda$connect$0(RobustHTTPClient.java:194)
       	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       	at java.base/java.lang.Thread.run(Thread.java:834)
      Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 0a07bc69-664c-47b3-9eb9-0a227df52a8f
      Caused: java.io.IOException: Failed to copy https://artifactory.example.com/artifactory/DevOpsTemp/jenkins/Test-Pipeline/36/artifacts/test#1.json to C:\j\workspace\Test-Pipeline\test#1.json
       	at hudson.plugins.copyartifact.CopyArtifact.copyOne(CopyArtifact.java:775)
       	at hudson.plugins.copyartifact.CopyArtifact.copy(CopyArtifact.java:715)
       	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:675)
       	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:559)
       	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
       	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
       	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
       	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
       	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
       	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
       	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
       	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
       	at java.base/java.lang.Thread.run(Thread.java:829)
      

      After examining the source code, I believe it's because the Copy Artifact plugin gets the external URL of the VirtualFile instance returned by the Artifact Manager and attempts to download it, but the special characters (# in this case) aren't escaped. Hence, an invalid URL is returned and Artifactory does not know how to serve the file.

          [JENKINS-73394] External URL may contain invalid characters

          FYI, I'm working on a solution to this problem now. I believe that while PR#14 was a good start, the external URL was missed and there may be others. I will attempt to resolve them all.

          Michael Tughan added a comment - FYI, I'm working on a solution to this problem now. I believe that while PR#14 was a good start, the external URL was missed and there may be others. I will attempt to resolve them all.

            jonesbusy Valentin Delaye
            mtughan Michael Tughan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: