GSA / datagov-wptheme

Data.gov WordPress Theme (obsolete)
https://www.data.gov
Other
1.88k stars 411 forks source link

Excel download files labeled as web page #832

Closed hkdctol closed 5 years ago

hkdctol commented 6 years ago

Issue raised by SSA. Creating issue to follow up on proposed solution, create PR, etc.

theresaanna commented 6 years ago

Needed: Where does this issue exist?

David-Blubaugh commented 6 years ago

Hi,

Sorry for the delay in getting you this information.

I found this issue with the SSA datasets on data.gov. The problem occurs when data.gov populates the datasets from the .json file. Any downloadable files with .xls or .xlsx extensions are labeled as "Web Page". I think I found the files that control the format labels and need to be updated, plugins.py and helpers.py.

plugins.py (https://github.com/GSA/ckanext-geodatagov/blob/master/ckanext/geodatagov/plugins.py) The RESOURCE_MAPPING section, around line 63, needs to be updated. I didn’t see .xls or .xlsx in the list, so I created an updated list, see the attached file. I tried to include most common mime_types. Does it look correct? RESOURCE_MAPPING.txt

helpers.py (https://github.com/GSA/ckanext-datagovtheme/blob/master/ckanext/datagovtheme/helpers.py) It has the function, convert_resource_format(format):, which calls the RESOURCE_MAPPING section of the plugins.py file, around line 356. The function also has an "else" that says "Web Page", which I think is the default. I think that the “else” format should be something more generic than “Web Page”. Maybe something like “Web Resource”.

Will the updates take care of the issue with Excel files being labeled as “Web Page”? Are there other places that would need to be updated?

I am not very familiar with python, so please double check my code. If there are mistakes, let me know, so I can learn from them.

Please let me know if you need any clarification.

Regards,

Dave

David-Blubaugh commented 6 years ago

Hi,

Here is a picture of one of the dataset pages.

data gov-excel file default text

Regards,

Dave

David-Blubaugh commented 6 years ago

Hi John,

What is the status of this fix? Was the code I provided correct?

Is there anything I can do to help? How does a Pull Request work and what do I need to make one?

Regards,

Dave

adborden commented 5 years ago

This PR is ready to be merged, thanks @David-Blubaugh https://github.com/GSA/ckanext-datagovtheme/pull/19#pullrequestreview-185743901

adborden commented 5 years ago

19 merged.