Add slash to WebDAV starting URL if missing (#8137)

If this is not done, the URL when the file is downloaded will be
something like hostdir/path, rather than host/dir/path.

Also add a debug log to make it more clear when a bogus URL
is being fetched,
pull/8141/head
John Beard 3 years ago committed by GitHub
parent dac3940ced
commit 27bf5b59dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -126,6 +126,14 @@ The start folder is appended to the server path.]])
text = text_button_ok,
callback = function()
local fields = MultiInputDialog:getFields()
-- make sure the URL is a valid path
if fields[5] ~= "" then
if string.sub(fields[5], 1, 1) ~= '/' then
fields[5] = '/' .. fields[5]
end
end
if fields[1] ~= "" and fields[2] ~= "" then
if item then
-- edit

@ -164,6 +164,7 @@ end
function WebDavApi:downloadFile(file_url, user, pass, local_path)
socketutil:set_timeout(socketutil.FILE_BLOCK_TIMEOUT, socketutil.FILE_TOTAL_TIMEOUT)
logger.dbg("WebDavApi: downloading file: ", file_url)
local code, _, status = socket.skip(1, http.request{
url = file_url,
method = "GET",

Loading…
Cancel
Save