Skip to content

Commit

Permalink
refactor: getBaseImagePaths method (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian authored Aug 6, 2024
1 parent a4b5550 commit 3886687
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/backend/src/updateBaseImagesInS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ export const filterNewImages = (s3Paths: string[]) => {

export const getBaseImagePaths = (newImagePaths: string[]) => {
return newImagePaths.map(path => {
const trimmedPath = path.replace(`${NEW_IMAGES_DIRECTORY}/`, '');
const commitHash = trimmedPath.split('/')[0] ?? '';
return trimmedPath
.replace(commitHash, BASE_IMAGES_DIRECTORY)
.replace(NEW_IMAGE_NAME, BASE_IMAGE_NAME);
const commitHash = path.split('/')[1] ?? '';
return path
.replace(`${NEW_IMAGES_DIRECTORY}/${commitHash}`, BASE_IMAGES_DIRECTORY)
.replace(`${NEW_IMAGE_NAME}.png`, `${BASE_IMAGE_NAME}.png`);
});
};

Expand Down

0 comments on commit 3886687

Please sign in to comment.