mirror of https://github.com/perkeep/perkeep.git
correct uploadUrl in preupload
This commit is contained in:
parent
dfc79a96fd
commit
bb3c33131e
|
@ -292,8 +292,17 @@ func handlePreUpload(conn *http.Conn, req *http.Request) {
|
||||||
ret := make(map[string]interface{})
|
ret := make(map[string]interface{})
|
||||||
ret["maxUploadSize"] = 2147483647 // 2GB.. *shrug*
|
ret["maxUploadSize"] = 2147483647 // 2GB.. *shrug*
|
||||||
ret["alreadyHave"] = haveVector.Copy()
|
ret["alreadyHave"] = haveVector.Copy()
|
||||||
ret["uploadUrl"] = "http://localhost:3179/camli/upload"
|
|
||||||
ret["uploadUrlExpirationSeconds"] = 86400
|
ret["uploadUrlExpirationSeconds"] = 86400
|
||||||
|
|
||||||
|
if len(req.Host) > 0 {
|
||||||
|
scheme := "http" // TODO: https
|
||||||
|
ret["uploadUrl"] = fmt.Sprintf("%s://%s/camli/upload",
|
||||||
|
scheme, req.Host)
|
||||||
|
} else {
|
||||||
|
ret["uploadUrl"] = "/camli/upload"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
returnJson(conn, ret)
|
returnJson(conn, ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue