Sharedown icon indicating copy to clipboard operation
Sharedown copied to clipboard

Direct download failed

Open jtojnar opened this issue 3 years ago • 9 comments

Using direct download fails for me on Sharedown 3.0.0 with a cryptic message:

Screenshot from 2021-11-25 18-53-42

sharedownLog.log:

makeDirectUrl:
rootfolder: /sites/Section_36662_RLB405/Sdilene dokumenty/General/Recordings/Jenom prohlížení/General-20211102_180259-Záznam schůzky.mp4
webUrl: https:,,ucnmuni.sharepoint.com,sites,Section_36662_RLB405
final: https://ucnmuni.sharepoint.com/sites/Section_36662_RLB405/Sdilene dokumenty/General/Recordings/Jenom prohlížení/General-20211102_180259-Záznam schůzky.mp4


runPuppeteerGetVideoData: direct mode: linkAr:
["https:","","ucnmuni.sharepoint.com","sites","Section_36662_RLB405","Sdilene dokumenty","General","Recordings","Jenom prohlížení","General-20211102_180259-Záznam schůzky.mp4"]


cookies: ["KillSwitchOverrides_disableKillSwitches","KillSwitchOverrides_enableKillSwitches","SPWorkLoadAttribution","CCSInfo","FedAuth","rtFa"]


YT-dlp: download failed:
ENOENT: no such file or directory, stat '/home/jtojnar/Downloads/sharedownVideos/General-20211102_180259-Záznam schůzky.mp4'

ytdlp.log:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
[generic] General-20211102_180259-Záznam schůzky: Requesting header
[redirect] Following redirect to https://ucnmuni.sharepoint.com/sites/Section_36662_RLB405/_layouts/15/AccessDenied.aspx?correlation=XXXXXXXX%XXXXXX%XXXXXX%XXXXXX%XXXXXXXXXXXXXX
[generic] AccessDenied: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] AccessDenied: Downloading webpage
[generic] AccessDenied: Extracting information
ERROR: Unsupported URL: https://ucnmuni.sharepoint.com/sites/Section_36662_RLB405/_layouts/15/AccessDenied.aspx?correlation=XXXXXXXX%XXXXXX%XXXXXX%XXXXXX%XXXXXXXXXXXXXX

jtojnar avatar Nov 25 '21 18:11 jtojnar

:warning: Additionally, Sharedown deletes the directory it is run from on the failure. Fortunately, I did not execute it normally so I only lost four months of changes of a Git repository I did not push to https://github.com/NixOS/nixpkgs, not the home directory :sob:

jtojnar avatar Nov 25 '21 19:11 jtojnar

This line is the likely culprit https://github.com/kylon/Sharedown/blob/d083a530df86f54e27660ee2d547155e0223ff3d/preload.js#L659

jtojnar avatar Nov 25 '21 19:11 jtojnar

warning Additionally, Sharedown deletes the directory it is run from on the failure. Fortunately, I did not execute it normally so I only lost four months of changes of a Git repository I did not push to https://github.com/NixOS/nixpkgs, not the home directory sob

i'm really sorry about that this is not inteded behaviour

i was able to reproduce, yes, that could to be the problem, a if is missing there :(

kylon avatar Nov 25 '21 19:11 kylon

Maybe defaulting these to null would be safer, since that will crash fs.rmSync, path.resolve and path.join, greatly reducing another incident like that when refactoring:

https://github.com/kylon/Sharedown/blob/d083a530df86f54e27660ee2d547155e0223ff3d/preload.js#L557-L559

jtojnar avatar Nov 25 '21 20:11 jtojnar

yea, thanks, fixing this now and simplifying a bit to hopefully prevent future oversights

kylon avatar Nov 25 '21 20:11 kylon

do you get a different error with 3.0.1?

kylon avatar Nov 25 '21 23:11 kylon

Screenshot from 2021-11-26 00-57-02

makeDirectUrl:
rootfolder: /sites/Section_36662_RLB405/Sdilene dokumenty/General/Recordings/Jenom prohlížení/General-20211102_180259-Záznam schůzky.mp4
webUrl: https:,,ucnmuni.sharepoint.com,sites,Section_36662_RLB405
final: https://ucnmuni.sharepoint.com/sites/Section_36662_RLB405/Sdilene dokumenty/General/Recordings/Jenom prohlížení/General-20211102_180259-Záznam schůzky.mp4
runPuppeteerGetVideoData: direct mode: linkAr:
["https:","","ucnmuni.sharepoint.com","sites","Section_36662_RLB405","Sdilene dokumenty","General","Recordings","Jenom prohlížení","General-20211102_180259-Záznam schůzky.mp4"]
cookies: ["KillSwitchOverrides_disableKillSwitches","KillSwitchOverrides_enableKillSwitches","SPWorkLoadAttribution","CCSInfo","FedAuth","rtFa"]
YT-dlp: download failed:
Exit code: 1
[generic] General-20211102_180259-Záznam schůzky: Requesting header
[redirect] Following redirect to https://ucnmuni.sharepoint.com/sites/Section_36662_RLB405/_layouts/15/AccessDenied.aspx?correlation=4abb06a0%2D60ad%2D3000%2D55fc%2D1dcb4c71199c
[generic] AccessDenied: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] AccessDenied: Downloading webpage
[generic] AccessDenied: Extracting information
ERROR: Unsupported URL: https://ucnmuni.sharepoint.com/sites/Section_36662_RLB405/_layouts/15/AccessDenied.aspx?correlation=4abb06a0%2D60ad%2D3000%2D55fc%2D1dcb4c71199c

jtojnar avatar Nov 25 '21 23:11 jtojnar

This line is the likely culprit

https://github.com/kylon/Sharedown/blob/d083a530df86f54e27660ee2d547155e0223ff3d/preload.js#L659

I couldn't figure out how that line could be causing your repo to get deleted. As per below line, tmp folder always tries to delete sharedownTmp. https://github.com/kylon/Sharedown/blob/d083a530df86f54e27660ee2d547155e0223ff3d/preload.js#L566

AndeYashwanth avatar Jun 24 '24 06:06 AndeYashwanth

That line only got called when isDirect was false. In my case, isDirect was true so tmpFold remained an empty string and _path.resolve('') evaluated to $PWD.

Thankfully, that was fixed in https://github.com/kylon/Sharedown/commit/db8e80a997b3b8ad1abd9d9951d094e4136c6ccd

jtojnar avatar Jun 24 '24 08:06 jtojnar