Skip to content

Commit

Permalink
Remove file ref utils from image utils
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown committed Aug 19, 2021
1 parent 9fe21e2 commit a3a3c1b
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions packages/keystone/src/fields/types/image/utils.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import { AssetMode, ImageExtension } from '@keystone-next/types';

const IMAGEREGEX = /^(local|keystone-cloud):image:([^\\\/:\n]+)\.(gif|jpg|png|webp)$/;
const FILEREGEX = /^(local|keystone-cloud):file:([^\\\/:\n]+)/;

export const getFileRef = (mode: AssetMode, name: string) => `${mode}:file:${name}`;
export const parseFileRef = (ref: string) => {
const match = ref.match(FILEREGEX);
if (match) {
const [, mode, filename] = match;
return {
mode: mode as AssetMode,
filename: filename as string,
};
}
return undefined;
};

export const getImageRef = (mode: AssetMode, id: string, extension: ImageExtension) =>
`${mode}:image:${id}.${extension}`;
Expand Down

0 comments on commit a3a3c1b

Please sign in to comment.