File tree 2 files changed +5
-5
lines changed
web/api/server/v1/contexts/torrent
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,10 @@ impl Index {
132
132
pub async fn add_torrent (
133
133
& self ,
134
134
add_torrent_req : AddTorrentRequest ,
135
- user_id : UserId ,
135
+ maybe_user_id : Option < UserId > ,
136
136
) -> Result < AddTorrentResponse , ServiceError > {
137
137
self . authorization_service
138
- . authorize ( ACTION :: AddTorrent , Some ( user_id ) )
138
+ . authorize ( ACTION :: AddTorrent , maybe_user_id )
139
139
. await ?;
140
140
141
141
let metadata = self . validate_and_build_metadata ( & add_torrent_req) . await ?;
@@ -149,7 +149,7 @@ impl Index {
149
149
150
150
let torrent_id = self
151
151
. torrent_repository
152
- . add ( & original_info_hash, & torrent, & metadata, user_id )
152
+ . add ( & original_info_hash, & torrent, & metadata, maybe_user_id . unwrap ( ) )
153
153
. await ?;
154
154
155
155
// Synchronous secondary tasks
Original file line number Diff line number Diff line change @@ -37,15 +37,15 @@ use crate::web::api::server::v1::routes::API_VERSION_URL_PREFIX;
37
37
#[ allow( clippy:: unused_async) ]
38
38
pub async fn upload_torrent_handler (
39
39
State ( app_data) : State < Arc < AppData > > ,
40
- ExtractLoggedInUser ( user_id ) : ExtractLoggedInUser ,
40
+ ExtractOptionalLoggedInUser ( maybe_user_id ) : ExtractOptionalLoggedInUser ,
41
41
multipart : Multipart ,
42
42
) -> Response {
43
43
let add_torrent_form = match build_add_torrent_request_from_payload ( multipart) . await {
44
44
Ok ( torrent_request) => torrent_request,
45
45
Err ( error) => return error. into_response ( ) ,
46
46
} ;
47
47
48
- match app_data. torrent_service . add_torrent ( add_torrent_form, user_id ) . await {
48
+ match app_data. torrent_service . add_torrent ( add_torrent_form, maybe_user_id ) . await {
49
49
Ok ( response) => new_torrent_response ( & response) . into_response ( ) ,
50
50
Err ( error) => error. into_response ( ) ,
51
51
}
You can’t perform that action at this time.
0 commit comments