Skip to content

Commit

Permalink
Better name
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Dec 28, 2024
1 parent 708e9e3 commit 695d60c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions psst-gui/src/webapi/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl WebApi {
},
)),
description: {
let desc = Self::sanitize_and_clean_description(
let desc = Self::sanitize_html(
item.content
.data
.description
Expand Down Expand Up @@ -622,9 +622,8 @@ impl WebApi {
})
}

fn sanitize_and_clean_description(description: &str) -> String {
fn sanitize_html(description: &str) -> String {
let sanitized = sanitize_str(&DEFAULT, description).unwrap_or_default();
// Replace HTML entities with their actual characters
sanitized.replace("&", "&")
}
}
Expand Down Expand Up @@ -1209,8 +1208,7 @@ impl WebApi {
let result = result
.into_iter()
.map(|mut playlist| {
playlist.description =
Self::sanitize_and_clean_description(&playlist.description).into();
playlist.description = Self::sanitize_html(&playlist.description).into();
playlist
})
.collect();
Expand All @@ -1234,7 +1232,7 @@ impl WebApi {
pub fn get_playlist(&self, id: &str) -> Result<Playlist, Error> {
let request = self.get(format!("v1/playlists/{}", id), None)?;
let mut result: Playlist = self.load(request)?;
result.description = Self::sanitize_and_clean_description(&result.description).into();
result.description = Self::sanitize_html(&result.description).into();
Ok(result)
}

Expand Down Expand Up @@ -1337,8 +1335,7 @@ impl WebApi {
page.items
.into_iter()
.map(|mut playlist| {
playlist.description =
Self::sanitize_and_clean_description(&playlist.description).into();
playlist.description = Self::sanitize_html(&playlist.description).into();
playlist
})
.collect()
Expand Down

0 comments on commit 695d60c

Please sign in to comment.