Browse Source

emoji filename unescape percent encode

kPherox 4 years ago
parent
commit
46ddae664d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      emoji-pack.go

+ 8 - 1
emoji-pack.go

@@ -122,7 +122,14 @@ func downloadEmojiFile(outputDir string, shortcode string, fileUrl string, resul
 	}
 	defer resp.Body.Close()
 
-	r.File = filepath.Base(u.String())
+	var ueu string
+	ueu, r.Error = url.PathUnescape(u.String())
+	if r.Error != nil {
+		<-limit
+		result <- r
+		return
+	}
+	r.File = filepath.Base(ueu)
 
 	var f *os.File
 	f, r.Error = os.Create(filepath.Join(outputDir, r.File))