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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug downloading files with long names #2929

Merged
merged 4 commits into from Jan 16, 2023

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Jan 4, 2023

Description

If the orig_name of a file is longer than 30 characters, the UI would truncate the name of the downloaded file to the first 30 characters. This causes the file extension to be ignored which can be a problem for some demos, like 3d object files, etc.

This is more noticeable now that we return tmp files with really long names

This PR

download_pr

Main

download_main

Checklist:

  • I have performed a self-review of my own code
  • I have added a short summary of my change to the CHANGELOG.md
  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

A note about the CHANGELOG

Hello 馃憢 and thank you for contributing to Gradio!

All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.

Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by [@myusername](link-to-your-github-profile) in [PR 11111](https://github.com/gradio-app/gradio/pull/11111)".

If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.

@gradio-pr-bot
Copy link
Contributor

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2929-all-demos

@freddyaboulton freddyaboulton changed the title Fix bug downloading files Fix bug downloading files with long names Jan 4, 2023
@freddyaboulton freddyaboulton force-pushed the fix-bug-downloading-files-longnames branch from ff2af78 to efeb98f Compare January 4, 2023 20:11
@freddyaboulton freddyaboulton marked this pull request as ready for review January 4, 2023 20:11
@freddyaboulton freddyaboulton mentioned this pull request Jan 4, 2023
@dawoodkhan82
Copy link
Collaborator

I can't reproduce the issue on main. Even with the long file name, my file still saves with the extension.

Screenshot 2023-01-09 at 6 42 54 PM

Screenshot 2023-01-09 at 6 43 34 PM

@abidlabs
Copy link
Member

abidlabs commented Jan 10, 2023

I tested this by running python .\demo\model3D\run.py on main and I got the issue that the file wasn't saved with the extension. See:

image

Can also confirm that this PR fixes it for me:

image

I'm not sure what would explain the discrepancy for you since I assume you and @freddyaboulton are both testing on Macs. Maybe there's a browser difference (I used Edge)? Nevertheless, LGTM from my end

@freddyaboulton freddyaboulton force-pushed the fix-bug-downloading-files-longnames branch from 48d5d54 to f5ba3cc Compare January 13, 2023 16:04
@abidlabs abidlabs merged commit 3f20748 into main Jan 16, 2023
@abidlabs abidlabs deleted the fix-bug-downloading-files-longnames branch January 16, 2023 02:58
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.

None yet

4 participants