{"record":{"id":"4d01b92e9aee0e28","repo":"tonhowtf/omniget","slug":"nenhum-redirect-encontrado-para","errorCode":null,"errorMessage":"Nenhum redirect encontrado para {}","messagePattern":"Nenhum redirect encontrado para (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"src-tauri/omniget-core/src/core/redirect.rs","lineNumber":9,"sourceCode":"use anyhow::anyhow;\n\npub async fn resolve_redirect(client: &reqwest::Client, url: &str) -> anyhow::Result<String> {\n    let response = client.get(url).send().await?;\n\n    let final_url = response.url().to_string();\n\n    if final_url == url {\n        return Err(anyhow!(\"Nenhum redirect encontrado para {}\", url));\n    }\n\n    Ok(final_url)\n}\n","sourceCodeStart":1,"sourceCodeEnd":14,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/redirect.rs#L1-L14","documentation":"resolve_redirect() performs a GET and compares the final response URL (after reqwest followed redirects) with the original. If they are identical, the URL did not redirect anywhere, so there is no 'resolved' URL to return and this error is thrown. It is a semantic failure: the request itself succeeded, but the input was not actually a redirecting URL.","triggerScenarios":"Calling resolve_redirect() with a direct/static URL that responds 200 at the same URL (no Location-based redirect); a URL using meta-refresh or JS redirect that reqwest cannot follow; a redirect loop that reqwest terminated by returning the same URL.","commonSituations":"Media sites switching from redirect endpoints to direct URLs; shortener already expanded; spicetify/marketplace links that serve content directly; redirect loops on misconfigured servers.","solutions":["Check whether the URL really is a redirector; if it's a direct link, use it as-is instead of resolving","Return the input URL as a fallback instead of failing when no redirect occurred","Increase reqwest redirect policy limits if loops are the cause and inspect the redirect history via response.history()","Handle meta/JS redirects manually by parsing the response body if the target site uses them"],"exampleFix":"// before\nlet final_url = resolve_redirect(&client, &url).await?;\n// after\nlet final_url = match resolve_redirect(&client, &url).await {\n    Ok(u) => u,\n    Err(_) => url.to_string(), // direct URL — use as-is\n};","handlingStrategy":"fallback","validationCode":"let resp = client.get(url).send().await?;\nif resp.url().as_str() == url {\n    eprintln!(\"URL is direct, no redirect to resolve\");\n}","typeGuard":null,"tryCatchPattern":"let final_url = resolve_redirect(&client, url)\n    .await\n    .unwrap_or_else(|_| url.to_string());","preventionTips":["Treat a no-redirect result as success and use the original URL","Check resp.history() to distinguish loops from genuinely direct URLs","Only call resolve_redirect on URLs known to be shorteners/redirect endpoints"],"tags":["network","http","redirect"],"backgroundTag":"unexpected-response-shape","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"}