Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for local file uploads without scheme #1326

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

d-vignesh
Copy link
Contributor

Fix issue on scenario where local file path is provided without scheme in add_external_file functionality.

Related Issue \ discussion

Fix for #1313

Patch Description

If the file added has a local path, the absolute path is fetched and the 'file://' scheme is added.

Testing Instructions

Described in [#1313]

Other Information

Tested file addition using absolute path, relative path and remote path. File addition and upload is working fine.
I could only test for Windows system.
image

…he absolute path for the file in such cases and use it as source url
if base_url != 'file://':
return remote_url
absoulte_path = os.path.abspath(remote_url)
return base_url + absoulte_path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that, in case a user adds a file that is already prefixed with file://, the os.path.abspath(remote_url) will return an unexpected value. For example:

>>> os.path.abspath("file:///home/ajecc/work")
'/home/ajecc/file:/home/ajecc/work'

I suggest checking if the remote_url already starts with file://, in which case you don't need to add the base_url

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting it @eugen-ajechiloae-clearml . Sorry i missed this case. Updated the code and tested it.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @eugen-ajechiloae-clearml , please review this change once when you get the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants