refactor: 🚨 Make class methods that don't use this static

This commit is contained in:
Jesse Wierzbinski 2024-10-03 13:51:19 +02:00
parent 53688095cc
commit 835cdc3f18
No known key found for this signature in database
7 changed files with 47 additions and 40 deletions

View file

@ -104,10 +104,9 @@ export class ImageConversionPreprocessor implements MediaPreprocessor {
fileName: string,
newExtension: string,
): string {
return this.extractFilenameFromPath(fileName).replace(
/\.[^/.]+$/,
`.${newExtension}`,
);
return ImageConversionPreprocessor.extractFilenameFromPath(
fileName,
).replace(/\.[^/.]+$/, `.${newExtension}`);
}
/**
@ -115,7 +114,7 @@ export class ImageConversionPreprocessor implements MediaPreprocessor {
* @param path - The path to extract the filename from.
* @returns The extracted filename.
*/
private extractFilenameFromPath(path: string): string {
private static extractFilenameFromPath(path: string): string {
const pathParts = path.split(/(?<!\\)\//);
return pathParts[pathParts.length - 1];
}