MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / Download

Function Download

src/webserver.go:1263–1278  ·  view source on GitHub ↗

Download : Datei Download

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1261
1262// Download : Datei Download
1263func Download(w http.ResponseWriter, r *http.Request) {
1264
1265 var path = r.URL.Path
1266 var file = System.Folder.Temp + getFilenameFromPath(path)
1267 w.Header().Set("Content-Disposition", "attachment; filename="+getFilenameFromPath(file))
1268
1269 content, err := readStringFromFile(file)
1270 if err != nil {
1271 w.WriteHeader(404)
1272 return
1273 }
1274
1275 os.RemoveAll(System.Folder.Temp + getFilenameFromPath(path))
1276 w.Write([]byte(content))
1277 return
1278}
1279
1280func setDefaultResponseData(response ResponseStruct, data bool) (defaults ResponseStruct) {
1281

Callers

nothing calls this directly

Calls 2

readStringFromFileFunction · 0.85
getFilenameFromPathFunction · 0.70

Tested by

no test coverage detected