{"record":{"id":"879efc7f4a6217f0","repo":"tonhowtf/omniget","slug":"a-api-oficial-so-aceita-urls-publicas-https-para-os-arquivos","errorCode":null,"errorMessage":"a API oficial so aceita URLs publicas (https://…) para os arquivos","messagePattern":"a API oficial so aceita URLs publicas \\(https://…\\) para os arquivos","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/instagram/publish.rs","lineNumber":606,"sourceCode":"    Err(anyhow!(\"o Instagram demorou demais para processar a midia\"))\n}\n\n/// Publica pela API oficial. `req.files` são URLs públicas.\npub async fn publish_graph(\n    auth: &GraphAuth,\n    req: &PublishRequest,\n    progress: &super::super::ProgressFn,\n    job: &str,\n) -> anyhow::Result<PublishResult> {\n    let id = format!(\"ig:{}\", job);\n    let http = super::super::client()?;\n    let token = auth.access_token.trim().to_string();\n    let user = auth.ig_user_id.trim().to_string();\n    if token.is_empty() || user.is_empty() {\n        return Err(anyhow!(\"informe o token e o ID da conta do Instagram\"));\n    }\n    if req.files.is_empty() || !req.files.iter().all(|f| f.starts_with(\"http\")) {\n        return Err(anyhow!(\n            \"a API oficial so aceita URLs publicas (https://…) para os arquivos\"\n        ));\n    }\n    let media_url = format!(\"{}/{}/media\", GRAPH, user);\n    let is_video = |f: &str| {\n        f.split('?')\n            .next()\n            .unwrap_or(f)\n            .to_lowercase()\n            .ends_with(\".mp4\")\n            || f.to_lowercase().ends_with(\".mov\")\n    };\n    let creation_id = match req.kind.as_str() {\n        \"carousel\" => {\n            let total = req.files.len() as u64 + 2;\n            let mut children = Vec::new();\n            for (i, f) in req.files.iter().enumerate() {\n                super::super::report(progress, &id, \"container\", i as u64, Some(total), None);","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/instagram/publish.rs#L588-L624","documentation":"The official Graph API cannot fetch files from the local disk or app storage; publish_graph therefore requires every entry in req.files to be a public http(s) URL. If the list is empty or any file fails the starts_with(\"http\") check, it raises \"a API oficial so aceita URLs publicas (https://…) para os arquivos\". This is a preflight validation of the publish payload.","triggerScenarios":"publish_graph called with req.files empty, or any path like \"/home/user/pics/a.jpg\", \"file:///...\", a bare \"data:\" URI, or a local relative path among the files.","commonSituations":"Caller reuses the web-publish flow that consumes local downloaded files and passes the same paths to the Graph flow; download-first pipeline hands local temp paths instead of hosted URLs; forgot to upload assets to a CDN/public host first.","solutions":["Upload the files to a publicly reachable HTTPS URL (CDN, object storage) and pass those URLs in req.files","Use publish_web instead when the source files are local, since it uploads them directly","Validate the file list before calling: non-empty and every entry starts with https://"],"exampleFix":"// before\nlet req = PublishRequest { files: vec![\"/tmp/media/a.jpg\".into()], .. };\npublish_graph(&auth, &req).await?; // Err\n// after\nlet req = PublishRequest { files: vec![\"https://cdn.example.com/a.jpg\".into()], .. };\npublish_graph(&auth, &req).await?;","handlingStrategy":"validation","validationCode":"let all_public = !req.files.is_empty()\n    && req.files.iter().all(|f| f.starts_with(\"https://\"));\nif !all_public {\n    return Err(\"todos os arquivos precisam de URLs públicas https://\");\n}","typeGuard":"fn all_files_are_public_urls(files: &[String]) -> bool {\n    !files.is_empty() && files.iter().all(|f| f.starts_with(\"http\"))\n}","tryCatchPattern":null,"preventionTips":["Upload local assets to a CDN/object store before using the Graph publish path","Route local-file requests to publish_web instead of publish_graph","Require https:// (not just http) in your own preflight for production use"],"tags":["instagram","graph-api","validation","url"],"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"}