Skip to content

Commit

Permalink
chore(common): Qualify the normalize_url into crate::normalize_url
Browse files Browse the repository at this point in the history
Signed-off-by: PrajwalCH <[email protected]>
  • Loading branch information
prajwalch committed Dec 29, 2023
1 parent 8f84672 commit 038c0f6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/common.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::fmt::Write;
use std::fs::DirEntry;
use std::io;
use std::path::Path;

use crate::normalize_url;

pub const PAGE_TEMPLATE: &str = include_str!("static/template.html");
pub const FILE_SVG_ICON: &str = include_str!("static/file.svg");
pub const FOLDER_SVG_ICON: &str = include_str!("static/folder.svg");
Expand Down Expand Up @@ -65,7 +64,7 @@ fn fs_path_to_url(root: &Path, path: &Path) -> String {
// /home/x/one/main.rs -> /main.rs
let relative_path = path.strip_prefix(root).unwrap_or(path);
// 2) Convert it to string and normalize it.
let mut url = normalize_url(&relative_path.to_string_lossy());
let mut url = crate::normalize_url(&relative_path.to_string_lossy());
// 3) Add trailing `/` if path points to a dir on disk.
if path.is_dir() {
url.push('/');
Expand Down

0 comments on commit 038c0f6

Please sign in to comment.