Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

fix up magnet links

Cette révision appartient à :
Eliot Whalan 2017-05-02 22:00:57 +10:00
Parent 585abef031
révision 17ba2510bf
Aucune clé n'a été trouvée pour cette signature dans la base de données
ID de la clé GPG: C0A42175139840D6

Voir le fichier

@ -9,6 +9,7 @@ import (
"html/template"
"log"
"net/http"
"net/url"
"os"
"strconv"
"time"
@ -54,7 +55,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
for rows.Next() {
var id, name, hash, magnet string
rows.Scan(&id, &name, &hash)
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + html.EscapeString(name) + "&tr=udp://tracker.openbittorrent.com"
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
res := Records{
Id: id,
Name: name,
@ -84,7 +85,7 @@ func singleapiHandler(w http.ResponseWriter, r *http.Request) {
for rows.Next() {
var id, name, hash, magnet string
rows.Scan(&id, &name, &hash)
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + html.EscapeString(name) + "&tr=udp://tracker.openbittorrent.com"
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
res := Records{
Id: id,
Name: name,
@ -116,7 +117,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
for rows.Next() {
var id, name, hash, magnet string
rows.Scan(&id, &name, &hash)
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + html.EscapeString(name) + "&tr=udp://tracker.openbittorrent.com"
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
res := Records{
Id: id,
Name: name,
@ -143,7 +144,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
for rows.Next() {
var id, name, hash, magnet string
rows.Scan(&id, &name, &hash)
magnet = "?xt=urn:btih:" + hash + "&dn=" + html.EscapeString(name) + "&tr=udp://tracker.openbittorrent.com"
magnet = "?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
res := Records{
Id: id,
Name: name,