Achrou / goindex-theme-acrou

This is a goindex theme.一个goindex的扩展主题。
https://ossdev.node6.workers.dev/
MIT License
1.62k stars 874 forks source link

"This file has been identified as malware or spam and cannot be downloaded." #113

Closed DKB0512 closed 4 years ago

DKB0512 commented 4 years ago

Whenever someone tries to download a file which is identified as malware or spam from google, index shows : { "error": { "errors": [ { "domain": "global", "reason": "cannotDownloadAbusiveFile", "message": "This file has been identified as malware or spam and cannot be downloaded." } ], "code": 403, "message": "This file has been identified as malware or spam and cannot be downloaded." } }

but If I try to download it from browser normally I can easily download it. Apparently it is the issue of "acknowledgeAbuse=true" which I don't know where to put it in code. So please fix this issue.

DKB0512 commented 4 years ago

Sorry for the issue but I fixed it and if someone is facing the same, 1) search for alt=media in the cloud worker code 2)add ?acknowledgeAbuse=true& before the alt=media it should be like this : ?acknowledgeAbuse=true&alt=media 3) save and deploy :)

christan-duplicate commented 3 years ago
async down(id, range = "", inline = false) {
    let url = `https://www.googleapis.com/drive/v3/files/${id}?alt=media`;
    //add
    if(!inline) url += "&acknowledgeAbuse=true";
    let requestOption = await this.requestOption();
    requestOption.headers["Range"] = range;
    let res = await fetch(url, requestOption);
    const { headers } = (res = new Response(res.body, res));
    this.authConfig.enable_cors_file_down &&
      headers.append("Access-Control-Allow-Origin", "*");
    inline === true && headers.set("Content-Disposition", "inline");
    return res;
  }