Clean up
This commit is contained in:
parent
755dcc8cf8
commit
696d74ca5e
2 changed files with 3 additions and 6 deletions
|
|
@ -251,8 +251,7 @@ export class FileOperations {
|
|||
: "";
|
||||
let stem = extension ? nameParts.slice(0, -1).join(".") : fileName;
|
||||
let currentCount = Number.parseInt(
|
||||
FileOperations.PARENTHESES_REGEX.exec(stem)?.groups?.["count"] ??
|
||||
"0"
|
||||
FileOperations.PARENTHESES_REGEX.exec(stem)?.groups?.count ?? "0"
|
||||
);
|
||||
stem = stem.replace(FileOperations.PARENTHESES_REGEX, "");
|
||||
|
||||
|
|
|
|||
|
|
@ -8,17 +8,15 @@ pub async fn find_first_available_path(
|
|||
database: &crate::app_state::database::Database,
|
||||
transaction: &mut Transaction<'_>,
|
||||
) -> Result<String> {
|
||||
let mut new_relative_path = String::default();
|
||||
for candidate in dedup_paths(sanitized_relative_path) {
|
||||
if database
|
||||
.get_latest_document_by_path(vault_id, &candidate, Some(transaction))
|
||||
.await?
|
||||
.is_none()
|
||||
{
|
||||
new_relative_path = candidate;
|
||||
break;
|
||||
return Ok(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(new_relative_path)
|
||||
unreachable!("dedup_paths produces infinite paths");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue