mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-07-15 16:09:13 +08:00
add support for http://localhost:8080/vid/key_cookie
or http://localhost:8080/vid/key_cookie.txt
This commit is contained in:
parent
de368ef3c3
commit
c6bd4e656e
@ -266,11 +266,20 @@ func DeleteHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseURLPath(path string) (vid, fid, filename, ext string) {
|
func parseURLPath(path string) (vid, fid, filename, ext string) {
|
||||||
if strings.Count(path, "/") == 3 {
|
switch strings.Count(path, "/") {
|
||||||
|
case 3:
|
||||||
parts := strings.Split(path, "/")
|
parts := strings.Split(path, "/")
|
||||||
vid, fid, filename = parts[1], parts[2], parts[3]
|
vid, fid, filename = parts[1], parts[2], parts[3]
|
||||||
ext = filepath.Ext(filename)
|
ext = filepath.Ext(filename)
|
||||||
} else {
|
case 2:
|
||||||
|
parts := strings.Split(path, "/")
|
||||||
|
vid, fid = parts[1], parts[2]
|
||||||
|
dotIndex := strings.LastIndex(fid, ".")
|
||||||
|
if dotIndex > 0 {
|
||||||
|
ext = fid[dotIndex:]
|
||||||
|
fid = fid[0:dotIndex]
|
||||||
|
}
|
||||||
|
default:
|
||||||
sepIndex := strings.LastIndex(path, "/")
|
sepIndex := strings.LastIndex(path, "/")
|
||||||
commaIndex := strings.LastIndex(path[sepIndex:], ",")
|
commaIndex := strings.LastIndex(path[sepIndex:], ",")
|
||||||
if commaIndex <= 0 {
|
if commaIndex <= 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user