Skip to content

Commit

Permalink
fix(audio-attachment): add optional chaining for this.name.replaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Oct 27, 2024
1 parent c6baff1 commit aece350
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class DiscordAudioAttachment extends DiscordMediaLifecycle implements Lig
* @remarks Spaces will be replaced with underscores and any non-alphanumeric characters will be removed
*/
@property()
public accessor name: string;
public accessor name: string | undefined;

/**
* The size of the audio file in bytes
Expand Down Expand Up @@ -172,7 +172,7 @@ export class DiscordAudioAttachment extends DiscordMediaLifecycle implements Lig
public accessor lightTheme = false;

protected override render() {
const parsedName = this.name.replaceAll(/\s/g, '_').replaceAll(/[^\w-]/g, '');
const parsedName = this.name?.replaceAll(/\s/g, '_')?.replaceAll(/[^\w-]/g, '');

return html`<div class="discord-media-attachment-non-visual-media-item-container">
<div class="discord-audio-attachment-non-visual-media-item">
Expand Down

0 comments on commit aece350

Please sign in to comment.