fix(web): escape file paths
This commit is contained in:
parent
f5eb8dac06
commit
b55865b8e7
@ -8,6 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -138,8 +139,13 @@ func HandlerTDBMS(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for index, element := range json_response.Data {
|
for index, element := range json_response.Data {
|
||||||
json_response.Data[index]["path"] =
|
path := strings.ReplaceAll(element["path"].(string), "/srv/data/tfm/", "")
|
||||||
strings.ReplaceAll(element["path"].(string), "/srv/data/tfm/", "")
|
splitpath := strings.Split(path, "/")
|
||||||
|
for pindex, pelement := range splitpath {
|
||||||
|
splitpath[pindex] = url.PathEscape(pelement)
|
||||||
|
}
|
||||||
|
path = strings.Join(splitpath, "/")
|
||||||
|
json_response.Data[index]["path"] = path
|
||||||
}
|
}
|
||||||
response, err = json.Marshal(json_response)
|
response, err = json.Marshal(json_response)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user