Fix required torrent name on upload
Cette révision appartient à :
Parent
0d36f59ca9
révision
b68bd9ead4
1 fichiers modifiés avec 11 ajouts et 5 suppressions
|
@ -221,6 +221,10 @@ func (r *TorrentRequest) ExtractEditInfo(req *http.Request) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = r.validateName()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
defer req.Body.Close()
|
defer req.Body.Close()
|
||||||
|
|
||||||
err = r.ExtractCategory(req)
|
err = r.ExtractCategory(req)
|
||||||
|
@ -288,12 +292,8 @@ func (r *TorrentRequest) ExtractBasicValue(req *http.Request) error {
|
||||||
r.Magnet = strings.TrimSpace(r.Magnet)
|
r.Magnet = strings.TrimSpace(r.Magnet)
|
||||||
|
|
||||||
// then actually check that we have everything we need
|
// then actually check that we have everything we need
|
||||||
err := r.validateName()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = r.validateDescription()
|
err := r.validateDescription()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,12 @@ func (r *TorrentRequest) ExtractInfo(req *http.Request) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We check name only here, reason: we can try to retrieve them from the torrent file
|
||||||
|
err = r.validateName()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// after data has been checked & extracted, write it to disk
|
// after data has been checked & extracted, write it to disk
|
||||||
if len(config.Conf.Torrents.FileStorage) > 0 {
|
if len(config.Conf.Torrents.FileStorage) > 0 {
|
||||||
err := writeTorrentToDisk(tfile, r.Infohash+".torrent", &r.Filepath)
|
err := writeTorrentToDisk(tfile, r.Infohash+".torrent", &r.Filepath)
|
||||||
|
|
Référencer dans un nouveau ticket