digital-preservation / csv-schema

CSV Schema
http://digital-preservation.github.io/csv-schema
Mozilla Public License 2.0
100 stars 33 forks source link

Add URL Decode to StringProvider to facilitate comparisons between text fields and URL fields #7

Open DavidUnderdown opened 8 years ago

DavidUnderdown commented 8 years ago

We sometimes have both a filename field and an identifier field. The identifier field is a URL with eg the full filepath of the file, as the URL is potentially encoded to avoid illegal characters such as spaces, it is currently not possible to compare directly to the filename field to ensure that the filename is identical to that in the filepath. The URL decode function should take encodings such as %20 in the URL and convert them back to their unencoded equivalents (eg space) to facilitate this comparison, so eg a URL "file:///c:/some/directory/structure/file%20with%20spaces%20in%20its%20name.txt" would be decoded to "file:///c:/some/directory/structure/file with spaces in its name.txt" so that column validation expression like filename: in(urlDecode($identifier)) would produce a useful result