Skip to content

Commit

Permalink
[#2553] Fix autodetect for tsv resources
Browse files Browse the repository at this point in the history
When you upload or link to a TSV file and don't specify a resource format,
the format that you end up with is text/tab-separated-values.
This is not recognized by the DataPusher and the resource is not uploaded to
 the DataStore.

This patch adds this alternative representation to the canonical resource
format list.
  • Loading branch information
amercader committed Jul 23, 2015
1 parent ea48ba3 commit 7e797b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/config/resource_formats.json
Expand Up @@ -18,7 +18,7 @@
["MDB", "Access Database", "application/x-msaccess", []],
["NetCDF", "NetCDF File", "application/netcdf", []],
["ArcGIS Map Service", "ArcGIS Map Service", "ArcGIS Map Service", ["arcgis map service"]],
["TSV", "Tab Separated Values File", "text/tsv", []],
["TSV", "Tab Separated Values File", "text/tsv", ["text/tab-separated-values"]],
["WFS", "Web Feature Service", null, []],
["ArcGIS Online Map", "ArcGIS Online Map", "ArcGIS Online Map", ["web map application"]],
["Perl", "Perl Script", "text/x-perl", []],
Expand Down
9 changes: 9 additions & 0 deletions ckan/tests/lib/test_helpers.py
Expand Up @@ -109,3 +109,12 @@ def test_includes_existing_license(self):
eq_(dict(licenses)['some-old-license'], 'some-old-license')
# and it is first on the list
eq_(licenses[0][0], 'some-old-license')


class TestResourceFormat(object):

def test_autodetect_tsv(self):

eq_(h.unified_resource_format('tsv'), 'TSV')

eq_(h.unified_resource_format('text/tab-separated-values'), 'TSV')

0 comments on commit 7e797b7

Please sign in to comment.