Skip to content

Commit

Permalink
Fixed media empty permalink errors (#2395)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsorohova authored Feb 6, 2024
1 parent 04befc3 commit 51a55fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/admin/media/imageDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class ImageDetailsModal extends React.Component<ImageDetailsModalProps, I
validatePermalink = async (permalink: string): Promise<string> => {
if (permalink === this.props.mediaItem?.permalink) return '';

const isPermalinkNotDefined = !(await this.mediaService.getMediaByPermalink(permalink)) && !reservedPermalinks.includes(permalink);
const isPermalinkNotDefined = permalink && !(await this.mediaService.getMediaByPermalink(permalink)) && !reservedPermalinks.includes(permalink);
let errorMessage = validateField(UNIQUE_REQUIRED, permalink, isPermalinkNotDefined);

if (errorMessage === '') errorMessage = validateField(URL_REQUIRED, permalink);
Expand Down
2 changes: 1 addition & 1 deletion src/admin/media/nonImageDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class NonImageDetailsModal extends React.Component<NonImageDetailsModalPr
validatePermalink = async (permalink: string): Promise<string> => {
if (permalink === this.props.mediaItem?.permalink) return '';

const isPermalinkNotDefined = !(await this.mediaService.getMediaByPermalink(permalink)) && !reservedPermalinks.includes(permalink);
const isPermalinkNotDefined = permalink && !(await this.mediaService.getMediaByPermalink(permalink)) && !reservedPermalinks.includes(permalink);
let errorMessage = validateField(UNIQUE_REQUIRED, permalink, isPermalinkNotDefined);

if (errorMessage === '') errorMessage = validateField(URL_REQUIRED, permalink);
Expand Down

0 comments on commit 51a55fb

Please sign in to comment.