WebAPI: Allow to set read-only directory as torrent location

PR #18613.
Closes #18480.
This commit is contained in:
Vladimir Golovnev 2023-02-27 09:09:33 +03:00 committed by Vladimir Golovnev (Glassez)
commit c21c3d2300
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7

View file

@ -1099,10 +1099,6 @@ void TorrentsController::setLocationAction()
if (!Utils::Fs::mkpath(newLocation)) if (!Utils::Fs::mkpath(newLocation))
throw APIError(APIErrorType::Conflict, tr("Cannot make save path")); throw APIError(APIErrorType::Conflict, tr("Cannot make save path"));
// check permissions
if (!Utils::Fs::isWritable(newLocation))
throw APIError(APIErrorType::AccessDenied, tr("Cannot write to directory"));
applyToTorrents(hashes, [newLocation](BitTorrent::Torrent *const torrent) applyToTorrents(hashes, [newLocation](BitTorrent::Torrent *const torrent)
{ {
LogMsg(tr("WebUI Set location: moving \"%1\", from \"%2\" to \"%3\"") LogMsg(tr("WebUI Set location: moving \"%1\", from \"%2\" to \"%3\"")