이미지 파생 파일 생성 안정화
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
import { z } from 'zod'
|
||||
import { ADMIN_POST_PLACEHOLDER_TITLE } from '../../lib/admin-post-title.js'
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
import { isPostCardThumbnailUrl } from '../../lib/post-card-thumbnail-url.js'
|
||||
import {
|
||||
isPageCoverThumbnailUrl,
|
||||
isPostBodyThumbnailUrl,
|
||||
isPostCardThumbnailUrl
|
||||
} from '../../lib/post-card-thumbnail-url.js'
|
||||
import { postStatusSchema } from './content-schema.js'
|
||||
|
||||
/**
|
||||
* 자동 생성 파생 이미지 URL인지 확인한다.
|
||||
* @param {string|null|undefined} imageUrl - 검사할 이미지 URL
|
||||
* @returns {boolean} 자동 생성 이미지이면 true
|
||||
*/
|
||||
const isGeneratedThumbnailUrl = (imageUrl) => isPostCardThumbnailUrl(imageUrl)
|
||||
|| isPostBodyThumbnailUrl(imageUrl)
|
||||
|| isPageCoverThumbnailUrl(imageUrl)
|
||||
|
||||
export const adminPostInputSchema = z.object({
|
||||
title: z.preprocess((val) => {
|
||||
const t = String(val ?? '').trim()
|
||||
@@ -16,7 +29,7 @@ export const adminPostInputSchema = z.object({
|
||||
.trim()
|
||||
.nullable()
|
||||
.default(null)
|
||||
.refine((value) => !isPostCardThumbnailUrl(value), '카드 썸네일은 대표 이미지로 사용할 수 없습니다.'),
|
||||
.refine((value) => !isGeneratedThumbnailUrl(value), '자동 생성 이미지는 대표 이미지로 사용할 수 없습니다.'),
|
||||
showFeaturedImage: z.boolean().default(false),
|
||||
isFeatured: z.boolean().default(false),
|
||||
seoTitle: z.string().trim().default(''),
|
||||
|
||||
Reference in New Issue
Block a user