diff --git a/backend/routes.go b/backend/routes.go index a44f124..db91761 100644 --- a/backend/routes.go +++ b/backend/routes.go @@ -56,7 +56,7 @@ func setupRoutes(env *web.Env) { // Torrents routes env.Handle("/torrents", torrents.DownloadHandler).WithRole(users.UserRole).Methods("POST") env.Handle("/torrents", torrents.ListHandler).WithRole(users.UserRole).Methods("GET") - env.Handle("/torrents/{id:[0-9]+}", torrents.RemoveHandler).WithRole(users.UserRole).Methods("DELETE") + env.Handle("/torrents/{id}", torrents.RemoveHandler).WithRole(users.UserRole).Methods("DELETE") env.Handle("/torrents/search/{type}/{search}", torrents.SearchHandler).WithRole(users.UserRole).Methods("GET") // Route to refresh all movies and shows diff --git a/backend/torrents/handlers.go b/backend/torrents/handlers.go index d0a3978..1f83b96 100644 --- a/backend/torrents/handlers.go +++ b/backend/torrents/handlers.go @@ -5,14 +5,13 @@ import ( "errors" "net/http" "sort" - "strconv" - "github.com/gorilla/mux" - "github.com/odwrtw/polochon/lib" - "github.com/sirupsen/logrus" "git.quimbo.fr/odwrtw/canape/backend/auth" "git.quimbo.fr/odwrtw/canape/backend/users" "git.quimbo.fr/odwrtw/canape/backend/web" + "github.com/gorilla/mux" + polochon "github.com/odwrtw/polochon/lib" + "github.com/sirupsen/logrus" ) // DownloadHandler downloads a movie via polochon @@ -79,10 +78,7 @@ func RemoveHandler(env *web.Env, w http.ResponseWriter, r *http.Request) error { // Get the torrent ID from the URL vars := mux.Vars(r) - torrentID, err := strconv.Atoi(vars["id"]) - if err != nil { - return env.RenderError(w, errors.New("invalid argument")) - } + torrentID := vars["id"] client, err := user.NewPapiClient() if err != nil { diff --git a/frontend/js/components/torrents/list.js b/frontend/js/components/torrents/list.js index 856edbc..df99d9c 100644 --- a/frontend/js/components/torrents/list.js +++ b/frontend/js/components/torrents/list.js @@ -111,7 +111,7 @@ class Torrent extends React.PureComponent { this.handleClick = this.handleClick.bind(this); } handleClick() { - this.props.removeTorrent(this.props.data.getIn(["additional_infos", "id"])); + this.props.removeTorrent(this.props.data.get("id")); } render() { const done = this.props.data.get("is_finished");