1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-06-05 04:24:05 +00:00

Fix the bug with different mime-types of uploaded binary parts

This commit is contained in:
bouncepaw 2020-11-02 00:09:41 +05:00
parent 4c852f60c4
commit a18ff06663
3 changed files with 5 additions and 3 deletions

View File

@ -125,6 +125,6 @@ func unixTimestampAsTime(ts string) *time.Time {
// Rename renames from `from` to `to` using `git mv`. // Rename renames from `from` to `to` using `git mv`.
func Rename(from, to string) error { func Rename(from, to string) error {
log.Println(util.ShorterPath(from), util.ShorterPath(to)) log.Println(util.ShorterPath(from), util.ShorterPath(to))
_, err := gitsh("mv", from, to) _, err := gitsh("mv", "--force", from, to)
return err return err
} }

View File

@ -77,7 +77,9 @@ func (hop *HistoryOp) WithFilesRenamed(pairs map[string]string) *HistoryOp {
for from, to := range pairs { for from, to := range pairs {
if from != "" { if from != "" {
os.MkdirAll(filepath.Dir(to), 0777) os.MkdirAll(filepath.Dir(to), 0777)
Rename(from, to) if err := Rename(from, to); err != nil {
hop.Errs = append(hop.Errs, err)
}
} }
} }
return hop return hop

View File

@ -80,7 +80,7 @@ func (hd *HyphaData) UploadBinary(hyphaName, mime string, file multipart.File, i
data, err = ioutil.ReadAll(file) data, err = ioutil.ReadAll(file)
) )
if err != nil { if err != nil {
return hop.WithError(err) return hop.WithError(err).Apply()
} }
return hd.uploadHelp(hop, hyphaName, MimeToExtension(mime), &hd.binaryPath, isOld, data) return hd.uploadHelp(hop, hyphaName, MimeToExtension(mime), &hd.binaryPath, isOld, data)