mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 23:54:22 +01:00
replaced h2non/filedetect with gabriel-vasile/mimetype library
* the mimetype library is faster and correctly detects text files as text/plain. (the filedetect library classified them as binary files) see #136
This commit is contained in:
@@ -204,13 +204,9 @@ func send(c *gin.Context, attachmentTmpDir string, signalCliConfig string, numbe
|
||||
return
|
||||
}
|
||||
|
||||
fType, err := filetype.Get(dec)
|
||||
if err != nil {
|
||||
c.JSON(400, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
mimeType := mimetype.Detect(dec)
|
||||
|
||||
attachmentTmpPath := attachmentTmpDir + u.String() + "." + fType.Extension
|
||||
attachmentTmpPath := attachmentTmpDir + u.String() + "." + mimeType.Extension()
|
||||
attachmentTmpPaths = append(attachmentTmpPaths, attachmentTmpPath)
|
||||
|
||||
f, err := os.Create(attachmentTmpPath)
|
||||
|
||||
Reference in New Issue
Block a user