{"record":{"id":"06d0e3c0d9f8046c","repo":"tonhowtf/omniget","slug":"o-arquivo-nao-e-publico-abra-no-navegador-e-use-arquivo","errorCode":null,"errorMessage":"o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download","messagePattern":"o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/gdocs.rs","lineNumber":75,"sourceCode":"    format: &str,\n    dest_dir: &str,\n    progress: super::ProgressFn,\n) -> anyhow::Result<String> {\n    let info = parse(url).ok_or_else(|| {\n        anyhow!(\"cole um link de docs.google.com (Documentos, Apresentações ou Planilhas)\")\n    })?;\n    if !info.formats.iter().any(|f| f == format) {\n        return Err(anyhow!(\n            \"formato {} nao disponivel para {}\",\n            format,\n            info.kind\n        ));\n    }\n    let client = super::client()?;\n    let export = export_url(&info, format);\n    let resp = client.get(&export).send().await?;\n    if resp.status().as_u16() == 401 || resp.status().as_u16() == 403 {\n        return Err(anyhow!(\n            \"o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download\"\n        ));\n    }\n    if !resp.status().is_success() {\n        return Err(anyhow!(\"Google Docs: HTTP {}\", resp.status()));\n    }\n    let name = resp\n        .headers()\n        .get(reqwest::header::CONTENT_DISPOSITION)\n        .and_then(|v| v.to_str().ok())\n        .and_then(filename_from_disposition)\n        .unwrap_or_else(|| format!(\"{}.{}\", info.id, format));\n    let dir = PathBuf::from(dest_dir);\n    std::fs::create_dir_all(&dir)?;\n    let dest = dir.join(super::sanitize_name(&name));\n    let bytes = resp.bytes().await?;\n    tokio::fs::write(&dest, &bytes).await?;\n    super::report(","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/gdocs.rs#L57-L93","documentation":"After sending the GET to the Google Docs export URL, download() maps HTTP 401/403 to this user-facing error. Google returns these statuses when the file is not shared publicly (the exporter requires no-auth access), so the tool cannot download it without a browser session.","triggerScenarios":"Calling download() on a Google Docs URL whose sharing is restricted: the file is private, shared only with specific accounts, or belongs to an organization requiring login; Google's export endpoint responds 401 or 403.","commonSituations":"Company Workspace files not shared 'Anyone with the link'; a personal Drive file after permission changes; links copied from an internal doc; shared-drive files requiring authenticated session.","solutions":["Open the file in a browser and share it as 'Anyone with the link' (viewer is enough), then retry","Alternatively download manually via Arquivo > Fazer download as the message suggests","Verify the URL is for a public file and not an internal Workspace-only doc"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match gdocs::download(&url, format).await {\n    Err(e) if e.to_string().contains(\"nao e publico\") => {\n        eprintln!(\"Arquivo privado: compartilhe como 'Qualquer pessoa com o link' e tente novamente.\");\n    }\n    Err(e) => eprintln!(\"falha: {e}\"),\n    Ok(path) => println!(\"baixado: {path}\"),\n}","preventionTips":["Check sharing settings ('Anyone with the link') before scripting a download","Test the export URL in an incognito browser first — if it asks for login, the API call will 403","For private files, use an authenticated Google Drive API flow instead"],"tags":["gdocs","http-403","permissions"],"backgroundTag":"permission-denied","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}