1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +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`.
func Rename(from, to string) error {
log.Println(util.ShorterPath(from), util.ShorterPath(to))
_, err := gitsh("mv", from, to)
_, err := gitsh("mv", "--force", from, to)
return err
}

View File

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

View File

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