Dear Gitlab users, due to maintenance reasons, Gitlab will not be available on Thursday 30.09.2021 from 5:00 pm to approximately 5:30 pm.

Commit a7d274f2 authored by Andreas Wagner's avatar Andreas Wagner
Browse files

Fix file download response. Resolves #24.

parent e18c0aac
......@@ -271,7 +271,10 @@ func SetupRoutes(conf tei2zenodo.Config) *gin.Engine {
c.Header("Location", DOIs[0])
}
if myDeposit.Changed {
c.XML(http.StatusOK, myDeposit.FileContent)
c.Header("Content-Description", "File Transfer")
c.Header("Content-Disposition", "attachment; filename="+myDeposit.Filename)
c.Data(http.StatusOK, "application/tei+xml", []byte(myDeposit.FileContent))
// c.XML(http.StatusOK, myDeposit.FileContent)
} else {
c.JSON(http.StatusCreated, gin.H{"doi": DOIs})
}
......
......@@ -84,6 +84,7 @@ func ProcessFile(r io.ReadSeeker, doi string, md *tei2zenodo.ZMetadata, myDeposi
return tei2zenodo.NewError("errInternal", fmt.Sprintf("error mixing new DOI into document: %s", MXErr), 500, MXErr)
}
myDeposit.FileContent = newfile
myDeposit.Changed = true
r = bytes.NewReader([]byte(newfile))
r.Seek(0, 0)
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment