Spaces:
Sleeping
Sleeping
Commit ·
034bbc3
1
Parent(s): 875ef91
Deploy files from GitHub repository
Browse files
config/upload_config.go
CHANGED
|
@@ -23,7 +23,7 @@ func NewUploadConfig() UploadConfig { return &uploadConfig{} }
|
|
| 23 |
func (c *uploadConfig) Get(contextType string) (UploadRule, error) {
|
| 24 |
codeExts := map[string]bool{".cpp": true, ".c": true, ".py": true, ".java": true, ".go": true, ".js": true, ".txt": true}
|
| 25 |
imgExts := map[string]bool{".jpg": true, ".jpeg": true, ".png": true, ".webp": true, ".gif": true}
|
| 26 |
-
docExts := map[string]bool{".pdf": true, ".doc": true, ".docx": true, ".xls": true, ".xlsx": true}
|
| 27 |
|
| 28 |
allExts := make(map[string]bool)
|
| 29 |
for k, v := range codeExts { allExts[k] = v }
|
|
|
|
| 23 |
func (c *uploadConfig) Get(contextType string) (UploadRule, error) {
|
| 24 |
codeExts := map[string]bool{".cpp": true, ".c": true, ".py": true, ".java": true, ".go": true, ".js": true, ".txt": true}
|
| 25 |
imgExts := map[string]bool{".jpg": true, ".jpeg": true, ".png": true, ".webp": true, ".gif": true}
|
| 26 |
+
docExts := map[string]bool{".pdf": true, ".doc": true, ".docx": true, ".xls": true, ".xlsx": true, ".csv": true}
|
| 27 |
|
| 28 |
allExts := make(map[string]bool)
|
| 29 |
for k, v := range codeExts { allExts[k] = v }
|
controllers/upload_controller.go
CHANGED
|
@@ -262,7 +262,7 @@ func (c *uploadController) inferContextFromExt(ext string) string {
|
|
| 262 |
".go": true, ".js": true, ".txt": true,
|
| 263 |
}
|
| 264 |
isDocument := map[string]bool{
|
| 265 |
-
".pdf": true, ".doc": true, ".docx": true, ".xls": true, ".xlsx": true,
|
| 266 |
}
|
| 267 |
|
| 268 |
if images[ext] {
|
|
|
|
| 262 |
".go": true, ".js": true, ".txt": true,
|
| 263 |
}
|
| 264 |
isDocument := map[string]bool{
|
| 265 |
+
".pdf": true, ".doc": true, ".docx": true, ".xls": true, ".xlsx": true, ".csv": true,
|
| 266 |
}
|
| 267 |
|
| 268 |
if images[ext] {
|
services/upload_service.go
CHANGED
|
@@ -194,6 +194,12 @@ func isValidMimeForExt(ext string, mimeType string) bool {
|
|
| 194 |
return baseMime == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || baseMime == "application/zip"
|
| 195 |
case ".txt":
|
| 196 |
return baseMime == "text/plain"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
case ".xls":
|
| 198 |
return baseMime == "application/vnd.ms-excel"
|
| 199 |
case ".xlsx":
|
|
|
|
| 194 |
return baseMime == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || baseMime == "application/zip"
|
| 195 |
case ".txt":
|
| 196 |
return baseMime == "text/plain"
|
| 197 |
+
case ".csv":
|
| 198 |
+
return baseMime == "text/csv" ||
|
| 199 |
+
baseMime == "text/plain" ||
|
| 200 |
+
baseMime == "application/csv" ||
|
| 201 |
+
baseMime == "application/vnd.ms-excel" ||
|
| 202 |
+
baseMime == "application/octet-stream"
|
| 203 |
case ".xls":
|
| 204 |
return baseMime == "application/vnd.ms-excel"
|
| 205 |
case ".xlsx":
|