Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-20480

Upload by checksum returns confusing 404 when checksum doesn't match

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 6.13.1
    • Fix Version/s: None
    • Component/s: REST API
    • Labels:
      None

      Description

      As per https://www.jfrog.com/confluence/plugins/servlet/mobile?contentId=46107948#ArtifactoryRESTAPI-DeployArtifactbyChecksum, if the checksum doesn't match, 404 is returned. I find this very confusing as 404 usually indicates that a file is missing (which implies that retrieval was attempted), which is not an expected response when trying to upload a file.

      From the HTTP spec (https://tools.ietf.org/html/rfc7231#section-6.5), I disagree that this scenario matches the expected use case for 404:

      The server has not found anything matching the effective request URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

      From this, it sounds as though the artifact doesn't exist and the web server either has no idea where it is or it doesn't want to reveal where it exists, neither of which would match my expected behaviour when uploading a file.

      Instead, I believe that 409 is a more appropriate response code, based on the HTTP spec:

      Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the representation being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response representation would likely contain a list of the differences between the two versions.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Woodz Richard
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: