{"record":{"id":"4e08e98a4a841639","repo":"tonhowtf/omniget","slug":"escolha-o-zip-do-export-do-reddit-ou-a-pasta-onde-ele-foi","errorCode":null,"errorMessage":"escolha o zip do export do Reddit ou a pasta onde ele foi descompactado","messagePattern":"escolha o zip do export do Reddit ou a pasta onde ele foi descompactado","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/gdpr.rs","lineNumber":256,"sourceCode":"            .flatten()\n        {\n            let p = entry.path();\n            if p.is_file() && is_csv(&p.to_string_lossy()) {\n                if let Ok(text) = read_text(p) {\n                    out.insert(short_name(&p.to_string_lossy()), text);\n                }\n            }\n        }\n        if out.is_empty() {\n            return Err(anyhow!(\n                \"nenhum .csv nesta pasta — aponte para a pasta do export ou para o zip\"\n            ));\n        }\n        return Ok(out);\n    }\n    let lower = path.to_string_lossy().to_ascii_lowercase();\n    if !lower.ends_with(\".zip\") {\n        return Err(anyhow!(\n            \"escolha o zip do export do Reddit ou a pasta onde ele foi descompactado\"\n        ));\n    }\n    let file = std::fs::File::open(path)?;\n    let mut zip =\n        zip::ZipArchive::new(file).map_err(|e| anyhow!(\"não foi possível abrir o zip: {}\", e))?;\n    for i in 0..zip.len() {\n        let mut entry = match zip.by_index(i) {\n            Ok(e) => e,\n            Err(_) => continue,\n        };\n        if !entry.is_file() || !is_csv(entry.name()) {\n            continue;\n        }\n        let name = short_name(entry.name());\n        let mut buf = Vec::new();\n        if entry.read_to_end(&mut buf).is_ok() {\n            out.insert(name, String::from_utf8_lossy(&buf).to_string());","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/gdpr.rs#L238-L274","documentation":"read_source() accepts either a directory of extracted CSVs or a .zip archive; the given path was neither, so it is rejected before any I/O. The message tells the user to supply the Reddit export zip or the unzipped folder.","triggerScenarios":"run() called with a path whose lowercased string does not end with '.zip' and which is not the directory case handled earlier (e.g. a single .csv file, a .tar.gz, or a missing extension).","commonSituations":"Passing an individual CSV instead of the export root; passing a .tar.gz or .7z export; a directory path with a trailing oddity; pointing at the downloaded but differently-formatted data request file.","solutions":["Pass the original GDPR export .zip file as the path","Or extract it and pass the resulting directory","Do not pass individual CSVs or other archive formats — repackage as zip if needed"],"exampleFix":"// before\npath: \"export/data.csv\"\n// after\npath: \"reddit_data_request_export.zip\"","handlingStrategy":"validation","validationCode":"fn looks_like_export_input(path: &str) -> bool {\n    let p = std::path::Path::new(path);\n    p.is_dir() || path.to_ascii_lowercase().ends_with(\".zip\")\n}\n// assert!(looks_like_export_input(&opts.path));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass either the .zip export or its extracted directory — nothing else","Never pass individual CSVs or tar/7z archives","Validate the file extension in your UI before invoking the tool"],"tags":["reddit","gdpr-export","zip","input-validation"],"backgroundTag":"invalid-argument-value","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"}