Skip to content

Incorrect folder remove when set site-pkg-dir and assets-dir at the same time and site-pkg-dir contains / #495

@ikai104

Description

@ikai104

When a project set both site-pkg-dir and asset-dir like this one:

[[workspace.metadata.leptos]]
site-pkg-dir = "static/pkg"  # set sub folder in here 
assets-dir = "assets"        # may contains some thing like `favicon.ico` and `static/my_image.png` and should not conflicted

The generated wasm & js will be removed due to following code:

let pkg_dir_name = match pkg_dir.file_name() {
Some(name) => name,
None => {
warn!("Assets No site-pkg-dir given, defaulting to 'pkg' for checks what to delete.");
warn!("Assets This will probably delete already generated files.");
"pkg"
}
};

if entry.file_name() != pkg_dir_name {
debug!(
"Assets removing folder {}",
GRAY.paint(path.to_string_lossy())
);
fs::remove_dir_all(path).await?;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions