Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct download failed #18

Open
jtojnar opened this issue Nov 25, 2021 · 9 comments
Open

Direct download failed #18

jtojnar opened this issue Nov 25, 2021 · 9 comments

Comments

@jtojnar
Copy link
Contributor

jtojnar commented Nov 25, 2021

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
Copy link
Contributor Author

jtojnar commented Nov 25, 2021

⚠️ 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 😭

@jtojnar
Copy link
Contributor Author

jtojnar commented Nov 25, 2021

This line is the likely culprit

_fs.rmSync(_path.resolve(tmpFold), { force: true, recursive: true });

@kylon
Copy link
Owner

kylon commented Nov 25, 2021

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 :(

@jtojnar
Copy link
Contributor Author

jtojnar commented Nov 25, 2021

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:

Sharedown/preload.js

Lines 557 to 559 in d083a53

let tmpFold = '';
let tmpOutFile = '';
let filename = '';

@kylon
Copy link
Owner

kylon commented Nov 25, 2021

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

@kylon
Copy link
Owner

kylon commented Nov 25, 2021

do you get a different error with 3.0.1?

@jtojnar
Copy link
Contributor Author

jtojnar commented Nov 25, 2021

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

@AndeYashwanth
Copy link

This line is the likely culprit

_fs.rmSync(_path.resolve(tmpFold), { force: true, recursive: true });

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.

tmpFold = _path.normalize(_path.join(outFolder, 'sharedownTmp'));

@jtojnar
Copy link
Contributor Author

jtojnar commented Jun 24, 2024

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 db8e80a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants