{"record":{"id":"3e0e5dd16b7fd24e","repo":"tonhowtf/omniget","slug":"cole-um-link-de-docs-google-com-documentos-apresenta-es-ou","errorCode":null,"errorMessage":"cole um link de docs.google.com (Documentos, Apresentações ou Planilhas)","messagePattern":"cole um link de docs\\.google\\.com \\(Documentos, Apresentações ou Planilhas\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/gdocs.rs","lineNumber":62,"sourceCode":"    if let Some(i) = v.find(\"filename*=UTF-8''\") {\n        let s = &v[i + 17..];\n        let end = s.find(';').unwrap_or(s.len());\n        return urlencoding::decode(&s[..end]).ok().map(|c| c.to_string());\n    }\n    let i = v.find(\"filename=\")?;\n    let s = v[i + 9..].trim().trim_matches('\"');\n    let end = s.find(';').unwrap_or(s.len());\n    Some(s[..end].trim_matches('\"').to_string())\n}\n\npub async fn download(\n    url: &str,\n    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()));","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/gdocs.rs#L44-L80","documentation":"download() parses the user-supplied URL with parse(url); if it does not match a Google Docs/Slides/Sheets document URL, parse returns None and this error is raised. It is an input validation error telling the user to paste a valid docs.google.com link.","triggerScenarios":"Calling download() with a URL that parse() cannot recognize: non-Google URL, a drive.google.com file link, a docs URL missing the document ID, malformed URL, or empty string.","commonSituations":"User pastes a Google Drive file link instead of an open docs.google.com document link; URL copied from the file list without the document ID; shortened or redirected URL; typo in the domain.","solutions":["Open the document in the browser and copy the URL while editing it — it must start with https://docs.google.com and contain the document ID","Verify the URL matches one of the supported kinds (Documentos/Apresentações/Planilhas) before calling","For Drive-stored files, use the appropriate Drive export/download API instead of this function"],"exampleFix":"// before\nlet url = \"https://drive.google.com/file/d/ABC123\"; // wrong host\n// after\nlet url = \"https://docs.google.com/document/d/ABC123/edit\";","handlingStrategy":"validation","validationCode":"// rust\nfn looks_like_gdocs(url: &str) -> bool {\n    let u = url.trim();\n    u.starts_with(\"https://docs.google.com/\")\n        && (u.contains(\"/document/\") || u.contains(\"/presentation/\") || u.contains(\"/spreadsheets/\"))\n}","typeGuard":null,"tryCatchPattern":"match gdocs::download(url, format, dest, progress).await {\n    Ok(path) => path,\n    Err(e) if e.to_string().contains(\"docs.google.com\") => {\n        anyhow::bail!(\"URL invalida: copie o link de edicao do documento no docs.google.com\")\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate the URL starts with https://docs.google.com and contains /document/, /presentation/ or /spreadsheets/ before calling","Reject drive.google.com links with a clear message pointing users to the docs editor URL","Trim whitespace and strip tracking suffixes from pasted URLs"],"tags":["url-validation","google-docs","input-validation"],"backgroundTag":"invalid-url-format","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"}