Skip to content

Skip-existing not working with artifactory when forbidden resources are hidden #918

@sebbegg

Description

@sebbegg

Your Environment

  1. Your operating system: MacOS

  2. Version of python you are running: Probably irrelevant - but 3.9

  3. How did you install twine? Did you use your operating system's package manager or pip or something else? Via pip

  4. Version of twine you have installed (include complete output of):

venv ❯ twine --version
twine version 4.0.1 (importlib-metadata: 4.6.0, keyring: 23.0.1, pkginfo: 1.8.3, requests: 2.25.1, requests-toolbelt: 0.9.1, urllib3: 1.26.6)
  1. Which package repository are you targeting? Artifactory in our company

The Issue

When artifactory is configured to hide resources that one doesn't have access to, --skip-existing does not work because Artifactory returns a 404 error instead of 403.
Artifactory docs: https://www.jfrog.com/confluence/display/JFROG/General+Security+Settings#GeneralSecuritySettings-HideExistenceofUnauthorizedResources

Steps to Reproduce

You'll need an appropriately configured artifactory service and a user without delete/overwrite permissions:

INFO     Response from https://artifacts.company.com/artifactory/api/pypi/pypi-snapshots:
         404 Not Found
INFO     {
           "errors" : [ {
             "status" : 404,
             "message" : "Could not locate artifact 'pypi-snapshots:pulumi-helpers/0.0.1.dev0/pulumi_helpers-0.0.1.dev0-py3-none-any.whl'."
           } ]
         }
ERROR    HTTPError: 404 Not Found from https://artifacts.company.com/artifactory/api/pypi/pypi-snapshots
         Not Found

I took a look into twine's code and in principle I guess this could easily be fixed by handling this in

def skip_upload(

On the other hand, 404 errors might be in general be "proper" 404 errors and adding a dedicated cli option seems weird too.
If you have a suggestion about how to handle this, I might find the time to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions