-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
needs triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Description
What information was incorrect, unhelpful, or incomplete?
Assume there is a folder files/zh-cn/path/to/folder
, which contains index.md
and some assets (a.png
, b.png
); and running rari content sync-translated-content
will move files/zh-cn/path/to/folder/index.md
to another folder.
The command is expected to move both index.md
and those assets (a.png
, b.png
) to other place, but it will only move the index.md
file. See the souce code:
rari/crates/rari-tools/src/sync_translated_content.rs
Lines 302 to 343 in f04be59
fn write_and_move_doc(doc: &Doc, target_slug: &str) -> Result<(), ToolError> { | |
let source_path = doc.path(); | |
let target_directory = root_for_locale(doc.locale())? | |
.join(doc.locale().as_folder_str()) | |
.join(url_to_folder_path(target_slug)); | |
std::fs::create_dir_all(&target_directory)?; | |
// Write the new slug, store the old slug in `original_slug` metadata | |
let mut new_doc = doc.clone(); | |
new_doc.meta.slug = target_slug.to_owned(); | |
new_doc.meta.original_slug = Some(doc.slug().to_owned()); | |
new_doc.write()?; | |
// Move the file with git | |
let output = exec_git_with_test_fallback( | |
&[ | |
OsStr::new("mv"), | |
source_path.as_os_str(), | |
target_directory.as_os_str(), | |
], | |
root_for_locale(doc.locale())?, | |
); | |
if !output.status.success() { | |
return Err(ToolError::GitError(format!( | |
"Failed to move files: {}", | |
String::from_utf8_lossy(&output.stderr) | |
))); | |
} | |
// If the source directory is empty, remove it with the fs api. | |
let source_directory = doc.full_path().parent().unwrap(); | |
if source_directory | |
.read_dir() | |
.map(|mut dir| dir.next().is_none()) | |
.unwrap_or(false) | |
{ | |
std::fs::remove_dir(source_directory)?; | |
} | |
Ok(()) | |
} |
What did you expect to see?
The rari content sync-translated-content
command will move index.md
and those assets which belong to the .md
file.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
Metadata
Metadata
Assignees
Labels
needs triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.Triage needed by staff and/or partners. Automatically applied when an issue is opened.