fix(local): filename with whitespace issue (#3928)

* fix(local): filename whitespace problem

* fix(deps): remove deprecated package io/ioutil

---------

Co-authored-by: XZB <i@1248.ink>
This commit is contained in:
XZB-1248
2023-03-23 15:18:37 +08:00
committed by GitHub
parent c6af22b97e
commit 0eab31bdf5
4 changed files with 24 additions and 9 deletions

View File

@ -4,8 +4,8 @@ import (
"context"
"encoding/base64"
"errors"
"io/ioutil"
"net/url"
"os"
"time"
)
@ -89,7 +89,7 @@ func (c *client) AddURI(uris []string, options ...interface{}) (gid string, err
// If a file with the same name already exists, it is overwritten!
// If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session.
func (c *client) AddTorrent(filename string, options ...interface{}) (gid string, err error) {
co, err := ioutil.ReadFile(filename)
co, err := os.ReadFile(filename)
if err != nil {
return
}
@ -120,7 +120,7 @@ func (c *client) AddTorrent(filename string, options ...interface{}) (gid string
// If a file with the same name already exists, it is overwritten!
// If the file cannot be saved successfully or --rpc-save-upload-metadata is false, the downloads added by this method are not saved by --save-session.
func (c *client) AddMetalink(filename string, options ...interface{}) (gid []string, err error) {
co, err := ioutil.ReadFile(filename)
co, err := os.ReadFile(filename)
if err != nil {
return
}