{"record":{"id":"92e12b77b393073a","repo":"tonhowtf/omniget","slug":"nao-achei-os-arquivos-data-js-do-arquivo-do-x","errorCode":null,"errorMessage":"nao achei os arquivos data/*.js do arquivo do X","messagePattern":"nao achei os arquivos data/\\*\\.js do arquivo do X","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/x/archive.rs","lineNumber":96,"sourceCode":"                }\n            }\n        } else {\n            let f = std::fs::File::open(p)?;\n            let mut zip = zip::ZipArchive::new(f)?;\n            for i in 0..zip.len() {\n                let mut entry = zip.by_index(i)?;\n                let full = entry.name().to_string();\n                let name = full.rsplit('/').next().unwrap_or(&full).to_string();\n                if full.contains(\"data/\") && name.ends_with(\".js\") && wanted(&name) {\n                    let mut s = String::new();\n                    if entry.read_to_string(&mut s).is_ok() {\n                        files.insert(name, s);\n                    }\n                }\n            }\n        }\n        if files.is_empty() {\n            return Err(anyhow!(\"nao achei os arquivos data/*.js do arquivo do X\"));\n        }\n        Ok(Self { files })\n    }\n\n    /// `tweets.js`, `tweets-part1.js`… concatenados em ordem.\n    fn json(&self, base: &str) -> Vec<Value> {\n        let mut names: Vec<&String> = self\n            .files\n            .keys()\n            .filter(|n| *n == &format!(\"{}.js\", base) || n.starts_with(&format!(\"{}-part\", base)))\n            .collect();\n        names.sort();\n        let mut out = Vec::new();\n        for n in names {\n            let s = &self.files[n];\n            let Some(i) = s.find('=') else { continue };\n            if let Ok(Value::Array(a)) =\n                serde_json::from_str::<Value>(s[i + 1..].trim().trim_end_matches(';'))","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/x/archive.rs#L78-L114","documentation":"X archive parsing (open) collects the data/*.js files (tweets.js, tweets-part1.js, etc.) from an exported X/Twitter archive. If after extraction none of those data files were found, it errors, meaning the zip either is not a genuine X data export or has an unexpected internal layout.","triggerScenarios":"Calling XArchive::open with a zip that contains no entries matching the data/*.js layout — wrong file selected, re-zipped archive with a wrapper folder, or a different export type (e.g. only 'assets').","commonSituations":"User uploads the wrong export (e.g. the 'tweet media' zip instead of the full data export); archives re-compressed by tools that dropped or renamed the data folder; corrupted/partial downloads.","solutions":["Request the full X data export (Settings > Your account > Download an archive) and use the untouched zip.","Open the zip and confirm a data/ directory containing *.js files (tweets.js etc.) exists at the expected path.","Re-download the archive if the zip is truncated or corrupted.","Do not re-zip with an extra top-level folder; keep the original structure."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before open(), sanity-check the zip contents\nlet names = zip_entries(path)?;\nif !names.iter().any(|n| n.starts_with(\"data/\") && n.ends_with(\".js\")) {\n    return Err(UserError::NotAnXArchive);\n}\nlet archive = XArchive::open(path)?;","typeGuard":"fn looks_like_x_archive(entries: &[String]) -> bool {\n    entries.iter().any(|n| n.starts_with(\"data/\") && n.ends_with(\".js\"))\n}","tryCatchPattern":"match XArchive::open(path) {\n    Ok(a) => use(a),\n    Err(e) if e.to_string().contains(\"data/*.js\") => show_dialog(\"This zip is not a full X data export; download the archive from Settings > Your account.\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Accept only the unmodified X 'twitter-*.zip' full data export.","Validate entry layout (data/*.js) before parsing.","Check zip integrity (truncated downloads) before opening.","Tell users not to re-zip or restructure the archive."],"tags":["x-archive","zip","missing-files","import"],"backgroundTag":"file-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}