Return direct URL in json responses
This commit is contained in:
parent
1fb92ffce3
commit
e506304b84
|
@ -53,6 +53,7 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
if strings.EqualFold("application/json", r.Header.Get("Accept")) {
|
||||
js, _ := json.Marshal(map[string]string{
|
||||
"filename": fileName,
|
||||
"direct_url": getSiteURL(r) + Config.selifPath + fileName,
|
||||
"expiry": strconv.FormatInt(metadata.Expiry.Unix(), 10),
|
||||
"size": strconv.FormatInt(metadata.Size, 10),
|
||||
"mimetype": metadata.Mimetype,
|
||||
|
|
|
@ -295,6 +295,7 @@ func generateBarename() string {
|
|||
func generateJSONresponse(upload Upload, r *http.Request) []byte {
|
||||
js, _ := json.Marshal(map[string]string{
|
||||
"url": getSiteURL(r) + upload.Filename,
|
||||
"direct_url": getSiteURL(r) + Config.selifPath + upload.Filename,
|
||||
"filename": upload.Filename,
|
||||
"delete_key": upload.Metadata.DeleteKey,
|
||||
"expiry": strconv.FormatInt(upload.Metadata.Expiry.Unix(), 10),
|
||||
|
|
Loading…
Reference in New Issue