|
@@ -370,12 +370,14 @@ func (s *Manager) HandleShareAccess(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if directDownload == true {
|
|
|
|
|
|
+ if directDownload {
|
|
//Serve the file directly
|
|
//Serve the file directly
|
|
w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+strings.ReplaceAll(url.QueryEscape(filepath.Base(shareOption.FileRealPath)), "+", "%20"))
|
|
w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+strings.ReplaceAll(url.QueryEscape(filepath.Base(shareOption.FileRealPath)), "+", "%20"))
|
|
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
|
|
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
|
|
http.ServeFile(w, r, shareOption.FileRealPath)
|
|
http.ServeFile(w, r, shareOption.FileRealPath)
|
|
- } else if directServe == true {
|
|
|
|
|
|
+ } else if directServe {
|
|
|
|
+ w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
|
+ w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
|
|
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
|
|
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
|
|
http.ServeFile(w, r, shareOption.FileRealPath)
|
|
http.ServeFile(w, r, shareOption.FileRealPath)
|
|
} else {
|
|
} else {
|