export scene

This commit is contained in:
tengge 2020-05-03 15:22:11 +08:00
parent 6b4554c1b7
commit b6041ab3bd

View File

@ -203,7 +203,7 @@ func Scene(w http.ResponseWriter, r *http.Request) {
}
for _, url := range urls {
if strings.HasPrefix(url, "/") { // 可能是base64地址
if !strings.HasPrefix(url, "/") { // 可能是base64地址
continue
}
@ -215,7 +215,7 @@ func Scene(w http.ResponseWriter, r *http.Request) {
continue
}
sourceDirName := filepath.Dir(server.MapPath(url))
sourceDirName := filepath.Dir(server.MapPath(_url))
targetDirName := filepath.Dir(strings.ReplaceAll(path+_url, "/", string(os.PathSeparator)))
helper.CopyDirectory(sourceDirName, targetDirName)
@ -267,7 +267,10 @@ func getURLInMaterial(material bson.M, urls *[]string) {
for _, material := range materials {
image := material["image"].(primitive.D).Map()
*urls = append(*urls, image["src"].(string))
src := image["src"].(string)
if strings.HasPrefix(src, "/") {
*urls = append(*urls, src)
}
}
}