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

Download CSV filename error #893

Closed
SarahBaghdadi opened this issue Sep 5, 2018 · 6 comments
Closed

Download CSV filename error #893

SarahBaghdadi opened this issue Sep 5, 2018 · 6 comments
Labels
confirmed bug Something isn't working
Milestone

Comments

@SarahBaghdadi
Copy link
Member

Hi all, the "Download CSV" feature generates a filename that doesn't open with my OS. For example I downloaded the file:

20180904-requests-sorts%5Bcreated_at%5D=desc&filters%5Bcompany_id%5D=2&properties%5B0%5D=company&properties%5B1%5D=courses&properties%5B2%5D=coursesNew&properties%5B3%5D=rate&properties%5B4%5D=paymentMethod&properties%5B5%5D=student.current.csv

generates the error:

"Sorry, we couldn't find /Users/A/Downloads/20180904-requests-sorts%5Bcreated_at%5D=desc&filters%5Bcompany_id%5D=2&properties%5B0%5D=company&properties%5B1%5D=courses&properties%5B2%5D=coursesNew&properties%5B3%5D=rate&properties%5B4%5D=paymentMethod&properties%5B5%5D=student.cur. Is it possible it was moved, renamed or deleted?"

The file itself is ok. If I change the filename to something else it opens and works fine. I'm using macOS 10.13.6 with Excel.

I think the error is because of the length of the filename since when I reduce it by a few words it fixes the problem. If the filename was something short like mytablename.csv that would be a lot more legible.

@alexweissman alexweissman added the confirmed bug Something isn't working label Sep 5, 2018
@alexweissman
Copy link
Member

We need to truncate the generated filenames to 255 characters, or whatever the maximum limit is for common OSes.

@amosfolz
Copy link
Contributor

One of the difficulties with this is that maximum file name length does not just include the file name, but the length of the directory and any parent directories the file is stored in. For example, on Windows the default download folder is C:\Users\Username\Downloads. Username could be any length up to 20 characters (or more in some environments).

Without a way to know the length of the username or the default download path, I'm making the assumption to keep filename under 150 characters, leaving roughly 100 characters for the default storage path.

I tried to keep it "pretty" by truncating to the nearest "&" before the 150th character, so the filename isn't just cut off at a random point.

amosfolz@02b0fdf

Let me know if this might work!

@lcharette
Copy link
Member

It's probably why most time you download a file, it's named download 🤕

@amosfolz
Copy link
Contributor

@alexweissman Can you provide any insight on why the file name was originally setup the way it was? I wonder if we can just make it simple and use $filename = "$date-{$this->name}"

@amosfolz
Copy link
Contributor

Any direction on how to move forward? I'd like to help fix this if I can.

@lcharette
Copy link
Member

I vote for nameOfTable.cvs

amosfolz added a commit to amosfolz/UserFrosting that referenced this issue Apr 3, 2019
Fix for userfrosting#893
Should prevent file names from exceeding maximum allowed.
@lcharette lcharette added this to the 4.2.1 milestone Apr 16, 2019
lcharette pushed a commit to userfrosting/sprinkle-core that referenced this issue May 31, 2021
Fix for userfrosting/UserFrosting#893
Should prevent file names from exceeding maximum allowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants