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 extension for file download in styles #541

Open
wants to merge 2 commits into
base: 2.8.x-qgis_server
Choose a base branch
from

Conversation

boney-bun
Copy link

fix #536

@boney-bun
Copy link
Author

tested on safari, chrome and firefox.

the PR in action using safari:
geonode-536-2

@lucernae i've tried the content_type of application/xml, but safari still automatically adding xml extention to the filename. so i define content_type of text/vnd.qt.qml for qml file.
found this content type here: https://www.ietf.org/mail-archive/web/media-types/current/msg00465.html

@gubuntu @NyakudyaA can text/vnd.qt.qml be used to define qml file in content type?

@gubuntu gubuntu changed the title Fix extention for file download in styles Fix extension for file download in styles Dec 17, 2018
@gubuntu
Copy link

gubuntu commented Dec 17, 2018

afaik Qt-QML is a completely different animal.

though if it serves to add the .qml suffix maybe it is OK?

@codecov
Copy link

codecov bot commented Dec 17, 2018

Codecov Report

Merging #541 into 2.8.x-qgis_server will decrease coverage by 7.95%.
The diff coverage is n/a.

Impacted file tree graph

@@                  Coverage Diff                  @@
##           2.8.x-qgis_server     #541      +/-   ##
=====================================================
- Coverage              41.52%   33.56%   -7.96%     
=====================================================
  Files                    412      412              
  Lines                  29670    29670              
  Branches                3752     3752              
=====================================================
- Hits                   12319     9958    -2361     
- Misses                 16589    19083    +2494     
+ Partials                 762      629     -133
Impacted Files Coverage Δ
geonode/qgis_server/views.py 0% <ø> (-60.42%) ⬇️
geonode/qgis_server/context_processors.py 0% <0%> (-100%) ⬇️
geonode/qgis_server/urls.py 0% <0%> (-100%) ⬇️
...ent/commands/delete_orphaned_qgis_server_layers.py 0% <0%> (-100%) ⬇️
geonode/qgis_server/tests/test_qgis_settings.py 0% <0%> (-100%) ⬇️
geonode/qgis_server/tests/test_xml_utilities.py 0% <0%> (-100%) ⬇️
.../qgis_server/migrations/0003_auto_20170727_0509.py 0% <0%> (-100%) ⬇️
.../qgis_server/migrations/0005_auto_20170823_0341.py 0% <0%> (-100%) ⬇️
geonode/qgis_server/migrations/0001_initial.py 0% <0%> (-100%) ⬇️
geonode/qgis_server/admin/__init__.py 0% <0%> (-100%) ⬇️
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba48295...eff57a1. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 17, 2018

Codecov Report

Merging #541 into 2.8.x-qgis_server will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           2.8.x-qgis_server     #541   +/-   ##
==================================================
  Coverage              41.52%   41.52%           
==================================================
  Files                    412      412           
  Lines                  29670    29670           
  Branches                3752     3752           
==================================================
  Hits                   12319    12319           
  Misses                 16589    16589           
  Partials                 762      762
Impacted Files Coverage Δ
geonode/qgis_server/views.py 60.41% <ø> (ø) ⬆️
geonode/qgis_server/tests/test_views.py 99.28% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba48295...eff57a1. Read the comment docs.

@gubuntu
Copy link

gubuntu commented Jan 7, 2019

@boney-bun respond and fix

Copy link
Collaborator

@lucernae lucernae left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @boney-bun !

I think this is fairly straightforward PR.

@lucernae
Copy link
Collaborator

lucernae commented Jan 7, 2019

For @gubuntu 's and @boney-bun 's comment:

@lucernae i've tried the content_type of application/xml, but safari still automatically adding xml extention to the filename. so i define content_type of text/vnd.qt.qml for qml file.
found this content type here: https://www.ietf.org/mail-archive/web/media-types/current/msg00465.html

The original mime type follows from QGIS definition taken here:
https://github.com/qgis/QGIS/blob/master/rpm/sources/qgis-mime.xml

There should be a way to force Safari to save the filename with QML extension (with mime type application/xml). This can be from Javascript file, communicated in the request header, or from download attribute.

afaik Qt-QML is a completely different animal. though if it serves to add the .qml suffix maybe it is OK?

Yes, I think this is last resort though. If above suggestion still not feasible :(.

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