Remove spaces in mime mapping and ensure no spaces in filenames
This commit is contained in:
parent
ca11d99678
commit
1e1f28658d
|
@ -230,6 +230,7 @@ func processUpload(upReq UploadRequest) (upload Upload, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
upload.Filename = strings.Join([]string{barename, extension}, ".")
|
upload.Filename = strings.Join([]string{barename, extension}, ".")
|
||||||
|
upload.Filename = strings.Replace(upload.Filename, " ", "", -1)
|
||||||
|
|
||||||
fileexists, _ := fileBackend.Exists(upload.Filename)
|
fileexists, _ := fileBackend.Exists(upload.Filename)
|
||||||
|
|
||||||
|
|
36
util.go
36
util.go
|
@ -44,7 +44,7 @@ var mimeToExtension = map[string]string{
|
||||||
"application/gpx+xml": "gpx",
|
"application/gpx+xml": "gpx",
|
||||||
"application/gxf": "gxf",
|
"application/gxf": "gxf",
|
||||||
"application/hyperstudio": "stk",
|
"application/hyperstudio": "stk",
|
||||||
"application/inkml+xml": "ink inkml",
|
"application/inkml+xml": "ink",
|
||||||
"application/ipfix": "ipfix",
|
"application/ipfix": "ipfix",
|
||||||
"application/java-archive": "jar",
|
"application/java-archive": "jar",
|
||||||
"application/java-serialized-object": "ser",
|
"application/java-serialized-object": "ser",
|
||||||
|
@ -135,7 +135,7 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.accpac.simply.aso": "aso",
|
"application/vnd.accpac.simply.aso": "aso",
|
||||||
"application/vnd.accpac.simply.imp": "imp",
|
"application/vnd.accpac.simply.imp": "imp",
|
||||||
"application/vnd.acucobol": "acu",
|
"application/vnd.acucobol": "acu",
|
||||||
"application/vnd.acucorp": "atc acutc",
|
"application/vnd.acucorp": "atc",
|
||||||
"application/vnd.adobe.air-application-installer-package+zip": "air",
|
"application/vnd.adobe.air-application-installer-package+zip": "air",
|
||||||
"application/vnd.adobe.formscentral.fcdt": "fcdt",
|
"application/vnd.adobe.formscentral.fcdt": "fcdt",
|
||||||
"application/vnd.adobe.fxp": "fxp",
|
"application/vnd.adobe.fxp": "fxp",
|
||||||
|
@ -226,14 +226,14 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.genomatix.tuxedo": "txd",
|
"application/vnd.genomatix.tuxedo": "txd",
|
||||||
"application/vnd.geogebra.file": "ggb",
|
"application/vnd.geogebra.file": "ggb",
|
||||||
"application/vnd.geogebra.tool": "ggt",
|
"application/vnd.geogebra.tool": "ggt",
|
||||||
"application/vnd.geometry-explorer": "gex gre",
|
"application/vnd.geometry-explorer": "gex",
|
||||||
"application/vnd.geonext": "gxt",
|
"application/vnd.geonext": "gxt",
|
||||||
"application/vnd.geoplan": "g2w",
|
"application/vnd.geoplan": "g2w",
|
||||||
"application/vnd.geospace": "g3w",
|
"application/vnd.geospace": "g3w",
|
||||||
"application/vnd.gmx": "gmx",
|
"application/vnd.gmx": "gmx",
|
||||||
"application/vnd.google-earth.kml+xml": "kml",
|
"application/vnd.google-earth.kml+xml": "kml",
|
||||||
"application/vnd.google-earth.kmz": "kmz",
|
"application/vnd.google-earth.kmz": "kmz",
|
||||||
"application/vnd.grafeq": "gqf gqs",
|
"application/vnd.grafeq": "gqf",
|
||||||
"application/vnd.groove-account": "gac",
|
"application/vnd.groove-account": "gac",
|
||||||
"application/vnd.groove-help": "ghf",
|
"application/vnd.groove-help": "ghf",
|
||||||
"application/vnd.groove-identity-message": "gim",
|
"application/vnd.groove-identity-message": "gim",
|
||||||
|
@ -256,7 +256,7 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.ibm.modcap": "afp",
|
"application/vnd.ibm.modcap": "afp",
|
||||||
"application/vnd.ibm.rights-management": "irm",
|
"application/vnd.ibm.rights-management": "irm",
|
||||||
"application/vnd.ibm.secure-container": "sc",
|
"application/vnd.ibm.secure-container": "sc",
|
||||||
"application/vnd.iccprofile": "icc icm",
|
"application/vnd.iccprofile": "icc",
|
||||||
"application/vnd.igloader": "igl",
|
"application/vnd.igloader": "igl",
|
||||||
"application/vnd.immervision-ivp": "ivp",
|
"application/vnd.immervision-ivp": "ivp",
|
||||||
"application/vnd.immervision-ivu": "ivu",
|
"application/vnd.immervision-ivu": "ivu",
|
||||||
|
@ -284,7 +284,7 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.kde.kword": "kwd",
|
"application/vnd.kde.kword": "kwd",
|
||||||
"application/vnd.kenameaapp": "htke",
|
"application/vnd.kenameaapp": "htke",
|
||||||
"application/vnd.kidspiration": "kia",
|
"application/vnd.kidspiration": "kia",
|
||||||
"application/vnd.kinar": "kne knp",
|
"application/vnd.kinar": "kne",
|
||||||
"application/vnd.koan": "skp",
|
"application/vnd.koan": "skp",
|
||||||
"application/vnd.kodak-descriptor": "sse",
|
"application/vnd.kodak-descriptor": "sse",
|
||||||
"application/vnd.las.las+xml": "lasxml",
|
"application/vnd.las.las+xml": "lasxml",
|
||||||
|
@ -330,13 +330,13 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.ms-officetheme": "thmx",
|
"application/vnd.ms-officetheme": "thmx",
|
||||||
"application/vnd.ms-pki.seccat": "cat",
|
"application/vnd.ms-pki.seccat": "cat",
|
||||||
"application/vnd.ms-pki.stl": "stl",
|
"application/vnd.ms-pki.stl": "stl",
|
||||||
"application/vnd.ms-powerpoint": "ppt pps pot",
|
"application/vnd.ms-powerpoint": "ppt",
|
||||||
"application/vnd.ms-powerpoint.addin.macroenabled.12": "ppam",
|
"application/vnd.ms-powerpoint.addin.macroenabled.12": "ppam",
|
||||||
"application/vnd.ms-powerpoint.presentation.macroenabled.12": "pptm",
|
"application/vnd.ms-powerpoint.presentation.macroenabled.12": "pptm",
|
||||||
"application/vnd.ms-powerpoint.slide.macroenabled.12": "sldm",
|
"application/vnd.ms-powerpoint.slide.macroenabled.12": "sldm",
|
||||||
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": "ppsm",
|
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": "ppsm",
|
||||||
"application/vnd.ms-powerpoint.template.macroenabled.12": "potm",
|
"application/vnd.ms-powerpoint.template.macroenabled.12": "potm",
|
||||||
"application/vnd.ms-project": "mpp mpt",
|
"application/vnd.ms-project": "mpp",
|
||||||
"application/vnd.ms-word.document.macroenabled.12": "docm",
|
"application/vnd.ms-word.document.macroenabled.12": "docm",
|
||||||
"application/vnd.ms-word.template.macroenabled.12": "dotm",
|
"application/vnd.ms-word.template.macroenabled.12": "dotm",
|
||||||
"application/vnd.ms-works": "wps",
|
"application/vnd.ms-works": "wps",
|
||||||
|
@ -347,7 +347,7 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.muvee.style": "msty",
|
"application/vnd.muvee.style": "msty",
|
||||||
"application/vnd.mynfc": "taglet",
|
"application/vnd.mynfc": "taglet",
|
||||||
"application/vnd.neurolanguage.nlu": "nlu",
|
"application/vnd.neurolanguage.nlu": "nlu",
|
||||||
"application/vnd.nitf": "ntf nitf",
|
"application/vnd.nitf": "ntf",
|
||||||
"application/vnd.noblenet-directory": "nnd",
|
"application/vnd.noblenet-directory": "nnd",
|
||||||
"application/vnd.noblenet-sealer": "nns",
|
"application/vnd.noblenet-sealer": "nns",
|
||||||
"application/vnd.noblenet-web": "nnw",
|
"application/vnd.noblenet-web": "nnw",
|
||||||
|
@ -389,7 +389,7 @@ var mimeToExtension = map[string]string{
|
||||||
"application/vnd.osgeo.mapguide.package": "mgp",
|
"application/vnd.osgeo.mapguide.package": "mgp",
|
||||||
"application/vnd.osgi.dp": "dp",
|
"application/vnd.osgi.dp": "dp",
|
||||||
"application/vnd.osgi.subsystem": "esa",
|
"application/vnd.osgi.subsystem": "esa",
|
||||||
"application/vnd.palm": "pdb pqa oprc",
|
"application/vnd.palm": "pdb",
|
||||||
"application/vnd.pawaafile": "paw",
|
"application/vnd.pawaafile": "paw",
|
||||||
"application/vnd.pg.format": "str",
|
"application/vnd.pg.format": "str",
|
||||||
"application/vnd.pg.osasli": "ei6",
|
"application/vnd.pg.osasli": "ei6",
|
||||||
|
@ -655,8 +655,8 @@ var mimeToExtension = map[string]string{
|
||||||
"image/png": "png",
|
"image/png": "png",
|
||||||
"image/prs.btif": "btif",
|
"image/prs.btif": "btif",
|
||||||
"image/sgi": "sgi",
|
"image/sgi": "sgi",
|
||||||
"image/svg+xml": "svg svgz",
|
"image/svg+xml": "svg",
|
||||||
"image/tiff": "tiff tif",
|
"image/tiff": "tiff",
|
||||||
"image/vnd.adobe.photoshop": "psd",
|
"image/vnd.adobe.photoshop": "psd",
|
||||||
"image/vnd.dece.graphic": "uvi",
|
"image/vnd.dece.graphic": "uvi",
|
||||||
"image/vnd.dvb.subtitle": "sub",
|
"image/vnd.dvb.subtitle": "sub",
|
||||||
|
@ -691,7 +691,7 @@ var mimeToExtension = map[string]string{
|
||||||
"image/x-xbitmap": "xbm",
|
"image/x-xbitmap": "xbm",
|
||||||
"image/x-xpixmap": "xpm",
|
"image/x-xpixmap": "xpm",
|
||||||
"image/x-xwindowdump": "xwd",
|
"image/x-xwindowdump": "xwd",
|
||||||
"message/rfc822": "eml mime",
|
"message/rfc822": "eml",
|
||||||
"model/iges": "igs",
|
"model/iges": "igs",
|
||||||
"model/mesh": "mesh",
|
"model/mesh": "mesh",
|
||||||
"model/vnd.collada+xml": "dae",
|
"model/vnd.collada+xml": "dae",
|
||||||
|
@ -700,12 +700,12 @@ var mimeToExtension = map[string]string{
|
||||||
"model/vnd.gtw": "gtw",
|
"model/vnd.gtw": "gtw",
|
||||||
"model/vnd.mts": "mts",
|
"model/vnd.mts": "mts",
|
||||||
"model/vnd.vtu": "vtu",
|
"model/vnd.vtu": "vtu",
|
||||||
"model/vrml": "wrl vrml",
|
"model/vrml": "wrl",
|
||||||
"model/x3d+binary": "x3db",
|
"model/x3d+binary": "x3db",
|
||||||
"model/x3d+vrml": "x3dv",
|
"model/x3d+vrml": "x3dv",
|
||||||
"model/x3d+xml": "x3d",
|
"model/x3d+xml": "x3d",
|
||||||
"text/cache-manifest": "appcache",
|
"text/cache-manifest": "appcache",
|
||||||
"text/calendar": "ics ifb",
|
"text/calendar": "ics",
|
||||||
"text/css": "css",
|
"text/css": "css",
|
||||||
"text/csv": "csv",
|
"text/csv": "csv",
|
||||||
"text/html": "html",
|
"text/html": "html",
|
||||||
|
@ -713,7 +713,7 @@ var mimeToExtension = map[string]string{
|
||||||
"text/plain": "txt",
|
"text/plain": "txt",
|
||||||
"text/prs.lines.tag": "dsc",
|
"text/prs.lines.tag": "dsc",
|
||||||
"text/richtext": "rtx",
|
"text/richtext": "rtx",
|
||||||
"text/sgml": "sgml sgm",
|
"text/sgml": "sgml",
|
||||||
"text/tab-separated-values": "tsv",
|
"text/tab-separated-values": "tsv",
|
||||||
"text/troff": "t",
|
"text/troff": "t",
|
||||||
"text/turtle": "ttl",
|
"text/turtle": "ttl",
|
||||||
|
@ -732,12 +732,12 @@ var mimeToExtension = map[string]string{
|
||||||
"text/vnd.sun.j2me.app-descriptor": "jad",
|
"text/vnd.sun.j2me.app-descriptor": "jad",
|
||||||
"text/vnd.wap.wml": "wml",
|
"text/vnd.wap.wml": "wml",
|
||||||
"text/vnd.wap.wmlscript": "wmls",
|
"text/vnd.wap.wmlscript": "wmls",
|
||||||
"text/x-asm": "s asm",
|
"text/x-asm": "s",
|
||||||
"text/x-c": "c",
|
"text/x-c": "c",
|
||||||
"text/x-fortran": "f",
|
"text/x-fortran": "f",
|
||||||
"text/x-java-source": "java",
|
"text/x-java-source": "java",
|
||||||
"text/x-opml": "opml",
|
"text/x-opml": "opml",
|
||||||
"text/x-pascal": "p pas",
|
"text/x-pascal": "p",
|
||||||
"text/x-nfo": "nfo",
|
"text/x-nfo": "nfo",
|
||||||
"text/x-shellscript": "sh",
|
"text/x-shellscript": "sh",
|
||||||
"text/x-setext": "etx",
|
"text/x-setext": "etx",
|
||||||
|
|
Loading…
Reference in New Issue