-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Dataset page] Add filename/extension to download attribute #117
Conversation
for json and geojson files. other file formats should have a name and don't need download attribute. note that download attribute only takes effect on same-origin
8e996b5
to
73cd07d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the title retrieved from the data-api ? It could be used to set name of the file instead of data.
What append to let fileName = ''
when it clicks on a csv format ?
5311a0b
to
de1abc7
Compare
de1abc7
to
9bf3549
Compare
Good point ! Completely forgot about that, added it now.
Do you mean "why"? The download attribute does not seem to affect formats that cannot be opened by the browser. Filenames including extension behave already as expected in this case if I saw right, so I just keep it empty in this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, for me, if the format is, by example csv, it won't go through :
if (this.format === 'geojson') {
completeFileName = `${fileName}.geojson`
} else if (this.format === 'json') {
completeFileName = `${fileName}.json`
}
Then completeFileName will be empty.
Yes, indeed, the logic will only be applied for json/geojson. If I remember correctly, the issue that the file is not being downloaded only occurs with these formats. Other fomats such as csv or xls do not seem to take the download attribute and its value into account. They are currently already getting downloaded with their title as filename. |
PR adds filename/extension to download attribute for json and geojson files. Other file formats should have a name and don't need download attribute. Note that download attribute only takes effect on same-origin.