1487c9a724e9516494ffe7b9bb407c5c17bdde27
galt
  Wed Oct 17 17:44:41 2012 -0700
fix for #9390 - tolerating url-encoded urls when detecting file compression type
diff --git src/hg/lib/customTrack.c src/hg/lib/customTrack.c
index 439704d..786f736 100644
--- src/hg/lib/customTrack.c
+++ src/hg/lib/customTrack.c
@@ -611,32 +611,38 @@
         cartSetString(cart, ctFileVar, ctFileName);
         }
     customTracksSaveFile(genomeDb, ctList, ctFileName);
     }
 else
     {
     /* no custom tracks remaining for this assembly */
     cartRemove(cart, ctFileVar);
     cartRemovePrefix(cart, CT_PREFIX);
     }
 }
 
 boolean customTrackIsCompressed(char *fileName)
 /* test for file suffix indicating compression */
 {
-    return (endsWith(fileName,".gz") || endsWith(fileName,".Z")  ||
-            endsWith(fileName,".bz2"));
+char *fileNameDecoded = cloneString(fileName);
+cgiDecode(fileName, fileNameDecoded, strlen(fileName));
+boolean result = 
+    (endsWith(fileNameDecoded,".gz") || 
+     endsWith(fileNameDecoded,".Z")  ||
+     endsWith(fileNameDecoded,".bz2"));
+freeMem(fileNameDecoded);
+return result;
 }
 
 static char *prepCompressedFile(struct cart *cart, char *fileName,
                                         char *binVar, char *fileVar)
 /* determine compression type and format properly for parser */
 {
     if (!customTrackIsCompressed(fileName))
     return NULL;
 char buf[256];
 char *cFBin = cartOptionalString(cart, binVar);
 if (cFBin)
     {
     safef(buf,sizeof(buf),"compressed://%s %s", fileName,  cFBin);
     /* cgi functions preserve binary data, cart vars have been
      *  cloneString-ed  which is bad for a binary stream that might