feat(core,board,ecommerce,page,ckeditor5,kginicis): 업로드 이미지 축소·로그인 2단계 인증 도입 + 파생 결함 수정

인터뷰에서 방향만 정하고 남겨 뒀던 후속 5건을 구현하고, 커밋 전 종합 점검에서
발견한 결함 2건을 함께 고쳤다.

기능 도입:
- 업로드 이미지 축소 — `upload.image_max_width` / `image_max_height` / `image_quality`
 는 저장·검증만 되고 리사이즈 코드가 0건이었다. 비율 유지, 상한 이내면 재인코딩하지
 않음(불필요한 화질 손실 방지), 한계 미설정이면 무동작(기존 사이트 이미지 보호).
 PNG·GIF·WebP 투명도 보존. 실패해도 업로드는 계속되고 원본이 저장된다.
- 로그인 2단계 인증 — `security.two_factor_auth` 는 설정 항목만 있고 구현도 화면
 컨트롤도 없었다. 코어 IDV 인프라를 재사용해 purpose `login` 을 추가하고, 비밀번호
 확인 통과 후 challenge 만 발행한다(토큰 미발급 + logout). `POST /api/auth/login/two-factor`
 가 코드를 확인해야 토큰이 나가며, 로그인과 같은 요청 제한을 적용한다. challenge 의
 purpose 를 대조해 다른 흐름의 challenge 로 로그인하는 것을 막는다. 코드 발송이
 실패하면 실패로 알린다 — 2단계를 건너뛰고 로그인시키면 통제가 조용히 열린다.

결함 수정:
- 게시글 수정 시 사용자 경로가 `attachment_ids` 를 Service 로 넘기지 않아, 검증과
 권한은 통과하고 200 을 받는데 첨부만 조용히 연결되지 않았다. 관리자 경로는 넘기고
 있어 같은 요청이 화면에 따라 다르게 동작했다.
- 설정 화면 라디오가 `pointer-events-none` + Label click 으로만 상태를 바꿔, 키보드
 방향키(change) 조작 시 화면 표시와 저장될 값이 어긋났다. 동일 패턴 4개 레이아웃
 12개 라디오에 change 액션을 부여하고 params 를 click 과 동일하게 고정한다.
- 주문완료 화면이 결제수단 확인보다 영수증 조회를 앞세워, PG 를 거치지 않는 주문에서도
 매번 404 요청이 나갔다.
- 개별 게시판 폼의 숫자 항목에 경계값 바인딩이 없어 환경설정 화면과 안내가 달랐다.

커밋 전 점검에서 발견:
- 2단계 인증이 반쪽으로 들어가 있었다. enum 에 case 만 추가하고 코어 purpose
 레지스트리와 ko/en 라벨을 빠뜨려, 목적 목록 API 에서 통째로 빠지고 `hasPurpose`
 가 false 였으며 라벨 대신 i18n 키 원문이 반환됐다. 관리자가 이 목적의 메시지
 템플릿·정책을 만들 수 없는 상태였다. 세 곳을 enum 기준으로 전수 대조하는 회귀
 테스트를 함께 둔다.
- 업로드 이미지 축소가 적용되지 않은 8번째 서비스(레이아웃 편집기 첨부)가 있었다.
 열거형 커버리지 테스트는 내 조사 결과를 green 으로 고정할 뿐 전수를 증명하지
 못한다 — 같은 규약을 조건으로 표현한 audit 룰이 첫 실행에서 검출했다.

재발 방지:
- audit 룰 `upload-service-image-resize` (신규 업로드 서비스의 축소 누락 검출)
- 트러블슈팅 사례 20 (코어 설정이 일부 경로에만 적용되는 증상의 진단 절차)
- `sirsoft-ckeditor5` 의 코어 최소 요구 버전을 7.0.6 으로 상향 (신설 클래스 의존)

공개 이슈: gnuboard/g7
This commit is contained in:
HeuJung committed 2026-07-30 07:57:06 +09:00
1 parent d17ea28da5
commit 7b56d5f23a
72 files changed
+2024 -99

No files matched your search

@@ -26,6 +26,9 @@
- 글을 쓰면서 파일을 함께 첨부하면 글은 저장되는데 첨부파일만 사라지던 문제를 수정했습니다. 첨부 개수·용량·형식 검사와 권한 확인은 모두 통과한 뒤 저장 단계에서만 빠져, 등록된 글에 첨부가 하나도 남지 않았습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 게시판 신고 정책의 자동 숨김 기준 횟수를 0(자동 숨김 사용 안 함)으로 입력할 수 없던 문제를 수정했습니다. 서버는 0을 "사용 안 함"으로 처리하는데 화면에서만 1 이상을 요구해, 0을 입력하면 저장은 되면서도 입력칸이 계속 오류 상태로 남았습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 설정 화면의 선택 항목(라디오 버튼)을 키보드 방향키로 고를 때 선택이 저장되지 않던 문제를 수정했습니다. 마우스 클릭은 정상 동작했으나, 키보드만 사용하는 경우 화면 표시와 실제 저장 값이 어긋날 수 있었습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 글을 수정하면서 미리 올려 둔 파일을 첨부하면 저장은 되는데 첨부만 연결되지 않던 문제를 수정했습니다. 관리자 화면에서는 정상 연결되어 같은 요청이 화면에 따라 다르게 동작했습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 개별 게시판을 수정할 때 목록 표시 개수·제목/내용 길이·댓글 깊이·첨부 개수 등 숫자 항목의 허용 범위가 화면에 표시되지 않던 문제를 수정했습니다. 게시판 환경설정(기본값) 화면에는 범위가 표시되는데 개별 게시판 화면에는 없어, 범위를 벗어난 값을 넣어도 저장을 눌러 봐야 알 수 있었습니다. 이제 두 화면이 같은 범위를 안내합니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 관리자 게시글 목록에서 글을 열어 이전글·다음글로 넘어가거나 수정 후 돌아올 때 보고 있던 페이지·검색어·분류가 사라지던 문제를 수정했습니다. 목록 ↔ 상세 ↔ 이전/다음 글 ↔ 작성·수정 폼 어디로 오가든 목록 상태가 유지되며, 신고 관리와 게시판 목록도 동일하게 개선됐습니다. 새로고침 버튼도 걸어 둔 검색·필터를 지운 채 새로 부르지 않고 보고 있던 목록을 그대로 다시 부릅니다. (#75 @jiwonpapa 님께서 제보해주셨습니다.)
- 관리자 게시글 목록에서 뒤쪽 페이지를 보던 중 검색하거나 게시 상태를 바꾸면 그 페이지 번호가 그대로 유지돼 결과가 없는 빈 화면이 열리던 문제를 수정했습니다. 검색과 상태 변경은 1페이지부터 보여주며, 사용자가 고른 표시 개수와 정렬은 그대로 유지됩니다. 검색창에서 엔터를 치는 경우와 검색 버튼을 누르는 경우가 서로 다르게 동작하던 것도 함께 맞췄습니다. (#75 @jiwonpapa 님께서 제보해주셨습니다.)
- 첨부파일을 사용하지 않는 게시판을 아무것도 바꾸지 않고 저장해도 "허용 파일 확장자를 최소 1개 이상 입력하세요" 오류가 나며 저장이 막히던 문제를 수정했습니다. 첨부를 쓰지 않는 게시판에서는 허용 확장자를 비워 두어도 정상적으로 저장됩니다. 게시판 환경설정의 기본값도 동일하게 동작합니다. (#78 @jiwonpapa 님께서 제보해주셨습니다.)
@@ -3148,9 +3148,13 @@ HTTP/1.1 200
| --- | --- | --- | --- | --- | --- |
| slug | path | string | 예 | — | 대상 리소스의 slug (URL 친화 식별자) |
| id | path | string | 예 | — | 대상 리소스의 식별자 |
| attachment_ids | body | integer[] | 아니오 | — | 미리 업로드해 둔 첨부 ID 목록. 게시글에 연결된다 (관리자 수정 경로와 동일) |
| temp_key | body | string | 아니오 | 최대 64자 | 임시 업로드 묶음 키. 해당 묶음의 첨부가 게시글로 이동·연결된다 |
> 이 엔드포인트는 확장이 파라미터를 추가할 수 있습니다 (`sirsoft-board.user_post.update_validation_rules`).
`attachment_ids` 는 **연결 대상**이며, 목록에서 뺀 기존 첨부를 삭제하지는 않습니다. 첨부 개수 상한은 이미 연결된 첨부까지 합산해 판정하므로 상한을 넘기면 `422`(`errors.code = attachment_limit_exceeded`)로 거부됩니다.
**요청 예시**
```http
@@ -0,0 +1,134 @@
/**
* 개별 게시판 수정 화면 — 숫자 입력 경계값 계약 테스트 (#493 T8)
*
* 배경: 같은 게시판 설정 항목이 두 화면에 있다.
* - 일괄(모듈 기본값): `admin_board_settings` → 데이터소스 `settings`(initLocal "form")
* - 개별(게시판별) : `admin_board_form` → 데이터소스 `boards`(initLocal "form")
*
* 두 화면 모두 서버가 `data._meta.limits` 로 같은 경계값을 내려준다
* (`BoardSettingsController::index()` / `BoardController::getFormData()`).
* 그런데 일괄 화면만 그 값을 min/max 로 바인딩하고 개별 화면은 아무 경계도 렌더하지 않아,
* 같은 항목인데 한 화면에서만 범위를 알 수 있는 비대칭이 생겼다.
*
* 저장은 `StoreBoardRequest`/`UpdateBoardRequest` 가 `ReadsBoardLimits` 로 동일하게 막으므로
* 잘못된 값이 저장되지는 않는다. 문제는 사용자가 **제출 전에** 알 수 없다는 것이다.
*
* 회귀 차단 포인트:
* 1. 개별 화면의 숫자 입력은 min/max 를 가진다 (미지정 금지).
* 2. 그 값은 리터럴이 아니라 `_local.form._meta.limits.*` 표현식이다
* (리터럴이면 config 를 바꿔도 화면이 따라오지 않아 원래 결함으로 되돌아간다).
* 3. 참조하는 limits 키는 일괄 화면이 쓰는 키와 동일하다 (두 화면이 갈라지지 않도록).
*/
import { describe, it, expect } from 'vitest';
import formTabList from '../../../layouts/admin/partials/admin_board_form/_tab_list.json';
import formTabPost from '../../../layouts/admin/partials/admin_board_form/_tab_post.json';
/**
* [필드명, partial, limits 키 prefix]
*
* per_page_mobile 은 per_page 와 같은 범위를 공유한다(일괄 화면과 동일 규약).
*/
const fields: Array<[string, unknown, string]> = [
['per_page', formTabList, 'per_page'],
['per_page_mobile', formTabList, 'per_page'],
['min_title_length', formTabPost, 'min_title_length'],
['max_title_length', formTabPost, 'max_title_length'],
['min_content_length', formTabPost, 'min_content_length'],
['max_content_length', formTabPost, 'max_content_length'],
['new_display_hours', formTabPost, 'new_display_hours'],
['max_reply_depth', formTabPost, 'max_reply_depth'],
['min_comment_length', formTabPost, 'min_comment_length'],
['max_comment_length', formTabPost, 'max_comment_length'],
['max_comment_depth', formTabPost, 'max_comment_depth'],
['max_file_size', formTabPost, 'max_file_size'],
['max_file_count', formTabPost, 'max_file_count'],
];
/**
* 레이아웃 트리에서 지정한 name 의 number 입력 props 를 찾습니다.
*
* @param node 탐색 대상 노드
* @param name 찾을 입력 name
* @returns 찾은 props (없으면 null)
*/
function findNumberInput(node: unknown, name: string): Record<string, unknown> | null {
if (Array.isArray(node)) {
for (const child of node) {
const found = findNumberInput(child, name);
if (found) return found;
}
return null;
}
if (node && typeof node === 'object') {
const props = (node as Record<string, unknown>).props as Record<string, unknown> | undefined;
if (props && props.type === 'number' && props.name === name) {
return props;
}
for (const value of Object.values(node as Record<string, unknown>)) {
const found = findNumberInput(value, name);
if (found) return found;
}
}
return null;
}
describe('개별 게시판 수정 화면 — 숫자 입력 경계값 계약 (#493 T8)', () => {
it.each(fields)('%s — min/max 가 지정되어 있다', (field, layout) => {
const props = findNumberInput(layout, field);
expect(props, `${field} 입력을 찾지 못했습니다`).not.toBeNull();
expect(props?.min, `${field}: min 미지정 — 사용자가 하한을 알 수 없습니다`).toBeDefined();
expect(props?.max, `${field}: max 미지정 — 사용자가 상한을 알 수 없습니다`).toBeDefined();
});
it.each(fields)('%s — 경계값이 _meta.limits 표현식이다 (리터럴 금지)', (field, layout, limitsKey) => {
const props = findNumberInput(layout, field);
expect(String(props?.min)).toBe(
`{{_local?.form?._meta?.limits?.${limitsKey}_min ?? ${fallbacks[`${limitsKey}_min`]}}}`
);
expect(String(props?.max)).toBe(
`{{_local?.form?._meta?.limits?.${limitsKey}_max ?? ${fallbacks[`${limitsKey}_max`]}}}`
);
});
});
/**
* 표현식 폴백 값 — `config/board.php` 의 limits 및 `ReadsBoardLimits` 기본치와 같은 값.
*
* 폴백까지 고정하는 이유: 폴백이 서버 기본치와 다르면 설정 응답이 늦거나 실패한 순간
* 화면이 서버와 다른 경계를 보여 준다.
*/
const fallbacks: Record<string, number> = {
per_page_min: 5,
per_page_max: 100,
min_title_length_min: 0,
min_title_length_max: 200,
max_title_length_min: 1,
max_title_length_max: 1000,
min_content_length_min: 0,
min_content_length_max: 10000,
max_content_length_min: 1,
max_content_length_max: 100000,
new_display_hours_min: 0,
new_display_hours_max: 720,
max_reply_depth_min: 1,
max_reply_depth_max: 10,
min_comment_length_min: 0,
min_comment_length_max: 1000,
max_comment_length_min: 1,
max_comment_length_max: 10000,
max_comment_depth_min: 0,
max_comment_depth_max: 10,
max_file_size_min: 1,
max_file_size_max: 200,
max_file_count_min: 1,
max_file_count_max: 20,
};
@@ -180,6 +180,8 @@
"props": {
"type": "number",
"name": "per_page",
"min": "{{_local?.form?._meta?.limits?.per_page_min ?? 5}}",
"max": "{{_local?.form?._meta?.limits?.per_page_max ?? 100}}",
"required": true,
"disabled": "{{_computed.isReadOnly}}",
"className": ""
@@ -235,6 +237,8 @@
"props": {
"type": "number",
"name": "per_page_mobile",
"min": "{{_local?.form?._meta?.limits?.per_page_min ?? 5}}",
"max": "{{_local?.form?._meta?.limits?.per_page_max ?? 100}}",
"required": true,
"disabled": "{{_computed.isReadOnly}}",
"className": ""
@@ -72,6 +72,8 @@
"props": {
"type": "number",
"name": "min_title_length",
"min": "{{_local?.form?._meta?.limits?.min_title_length_min ?? 0}}",
"max": "{{_local?.form?._meta?.limits?.min_title_length_max ?? 200}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -126,6 +128,8 @@
"props": {
"type": "number",
"name": "max_title_length",
"min": "{{_local?.form?._meta?.limits?.max_title_length_min ?? 1}}",
"max": "{{_local?.form?._meta?.limits?.max_title_length_max ?? 1000}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -190,6 +194,8 @@
"props": {
"type": "number",
"name": "min_content_length",
"min": "{{_local?.form?._meta?.limits?.min_content_length_min ?? 0}}",
"max": "{{_local?.form?._meta?.limits?.min_content_length_max ?? 10000}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -244,6 +250,8 @@
"props": {
"type": "number",
"name": "max_content_length",
"min": "{{_local?.form?._meta?.limits?.max_content_length_min ?? 1}}",
"max": "{{_local?.form?._meta?.limits?.max_content_length_max ?? 100000}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -354,6 +362,8 @@
"props": {
"type": "number",
"name": "new_display_hours",
"min": "{{_local?.form?._meta?.limits?.new_display_hours_min ?? 0}}",
"max": "{{_local?.form?._meta?.limits?.new_display_hours_max ?? 720}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -453,7 +463,8 @@
"props": {
"type": "number",
"name": "max_reply_depth",
"min": 1,
"min": "{{_local?.form?._meta?.limits?.max_reply_depth_min ?? 1}}",
"max": "{{_local?.form?._meta?.limits?.max_reply_depth_max ?? 10}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -561,6 +572,8 @@
"props": {
"type": "number",
"name": "min_comment_length",
"min": "{{_local?.form?._meta?.limits?.min_comment_length_min ?? 0}}",
"max": "{{_local?.form?._meta?.limits?.min_comment_length_max ?? 1000}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -615,6 +628,8 @@
"props": {
"type": "number",
"name": "max_comment_length",
"min": "{{_local?.form?._meta?.limits?.max_comment_length_min ?? 1}}",
"max": "{{_local?.form?._meta?.limits?.max_comment_length_max ?? 10000}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -672,6 +687,8 @@
"props": {
"type": "number",
"name": "max_comment_depth",
"min": "{{_local?.form?._meta?.limits?.max_comment_depth_min ?? 0}}",
"max": "{{_local?.form?._meta?.limits?.max_comment_depth_max ?? 10}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -825,6 +842,8 @@
"props": {
"type": "number",
"name": "max_file_count",
"min": "{{_local?.form?._meta?.limits?.max_file_count_min ?? 1}}",
"max": "{{_local?.form?._meta?.limits?.max_file_count_max ?? 20}}",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
}
@@ -879,6 +898,8 @@
"props": {
"type": "number",
"name": "max_file_size",
"min": "{{_local?.form?._meta?.limits?.max_file_size_min ?? 1}}",
"max": "{{_local?.form?._meta?.limits?.max_file_size_max ?? 200}}",
"placeholder": "$t:sirsoft-board.admin.form.fields.max_file_size.placeholder",
"disabled": "{{_computed.isReadOnly}}",
"className": ""
@@ -43,8 +43,7 @@
"id": "date_display_format_field",
"type": "basic",
"name": "Div",
"props": {
},
"props": {},
"children": [
{
"type": "basic",
@@ -101,10 +100,27 @@
"type": "radio",
"name": "display.date_display_format",
"value": "standard",
"className": "radio mt-0.5 pointer-events-none",
"className": "radio mt-0.5",
"disabled": "{{_computed.isReadOnly}}",
"checked": "{{(_local.form?.display?.date_display_format ?? 'standard') === 'standard'}}"
}
},
"actions": [
{
"type": "change",
"handler": "setState",
"params": {
"target": "local",
"form": {
"...": "{{_local.form}}",
"display": {
"...": "{{_local.form?.display}}",
"date_display_format": "standard"
}
},
"hasChanges": true
}
}
]
},
{
"type": "basic",
@@ -173,10 +189,27 @@
"type": "radio",
"name": "display.date_display_format",
"value": "relative",
"className": "radio mt-0.5 pointer-events-none",
"className": "radio mt-0.5",
"disabled": "{{_computed.isReadOnly}}",
"checked": "{{(_local.form?.display?.date_display_format ?? 'standard') === 'relative'}}"
}
},
"actions": [
{
"type": "change",
"handler": "setState",
"params": {
"target": "local",
"form": {
"...": "{{_local.form}}",
"display": {
"...": "{{_local.form?.display}}",
"date_display_format": "relative"
}
},
"hasChanges": true
}
}
]
},
{
"type": "basic",
@@ -382,7 +382,14 @@ class PostController extends PublicBaseController
// 게시글 수정
$data = $request->validated();
$post = $this->postService->updatePost($slug, $id, $data);
// `attachment_ids` 를 Service 로 넘기지 않으면 검증(형식·개수 상한 합산)은 통과하고
// 첨부만 조용히 연결되지 않는다 (200 + 첨부 0 건). 관리자 경로는 넘기고 있으므로
// 같은 요청이 화면에 따라 다르게 동작했다.
$attachmentIds = $data['attachment_ids'] ?? [];
unset($data['attachment_ids']);
$post = $this->postService->updatePost($slug, $id, $data, $attachmentIds);
// board 관계 수동 설정
$post->setRelation('board', $board);
@@ -5,6 +5,7 @@ namespace Modules\Sirsoft\Board\Services;
use App\Contracts\Extension\StorageInterface;
use App\Extension\HookManager;
use App\Helpers\PermissionHelper;
use App\Support\ImageResizer;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\UploadedFile;
@@ -127,6 +128,10 @@ class AttachmentService
$path = "{$slug}/temp/{$tempKey}/{$storedFilename}";
}
// 환경설정 > 업로드의 최대 가로/세로·품질을 적용한다 (코어 설정이 모든 업로드 경로에 동일 적용).
// 임시 파일을 제자리에서 줄이므로 아래의 저장·크기 계산이 모두 축소본을 본다.
app(ImageResizer::class)->resizeInPlace($file->getRealPath(), $file->getMimeType());
// 스토리지에 파일 저장 (category: 'attachments')
$this->storage->put('attachments', $path, file_get_contents($file->getRealPath()));
@@ -442,6 +442,64 @@ class AttachmentLimitTest extends BoardTestCase
->assertSuccessful();
}
/**
* 수정 시 `attachment_ids` 로 보낸 첨부가 사용자 경로에서도 실제로 연결된다.
*
* 결함: 관리자 컨트롤러는 `attachment_ids` 를 뽑아 Service 로 넘기는데 사용자 컨트롤러는
* 넘기지 않았다. 그래서 같은 요청이 검증(형식·개수 상한 합산)은 통과하고 200 을 받는데
* 첨부만 조용히 연결되지 않았다 — 화면에는 성공으로 보이고 첨부만 사라진다.
* 작성 경로의 `files[]` 유실과 같은 계열이며, 두 경로가 같은 강도여야 한다.
*/
public function test_update_links_attachment_ids_on_user_path(): void
{
$postId = $this->createTestPost(['user_id' => $this->memberUser->id]);
$tempKey = 'tk_'.str_repeat('u', 20);
$this->seedTempAttachments($tempKey, 2);
$attachmentIds = Attachment::where('temp_key', $tempKey)->pluck('id')->all();
$response = $this->actingAs($this->memberUser, 'sanctum')->putJson(
"/api/modules/sirsoft-board/boards/{$this->getTestBoardSlug()}/posts/{$postId}",
[
'title' => '첨부 연결 수정',
'content' => '본문은 최소 길이를 넘겨야 검증을 통과합니다.',
'attachment_ids' => $attachmentIds,
]
);
$response->assertStatus(200);
$this->assertSame(
2,
Attachment::where('post_id', $postId)->count(),
'attachment_ids 로 보낸 첨부가 게시글에 연결되지 않았습니다 — 응답은 성공인데 첨부만 사라집니다.'
);
}
/**
* 수정 경로의 `attachment_ids` 도 개수 상한을 넘기면 차단된다 (위 경계의 대조군).
*/
public function test_update_attachment_ids_over_limit_is_blocked(): void
{
$postId = $this->createTestPost(['user_id' => $this->memberUser->id]);
$tempKey = 'tk_'.str_repeat('o', 20);
$this->seedTempAttachments($tempKey, 6);
$attachmentIds = Attachment::where('temp_key', $tempKey)->pluck('id')->all();
$response = $this->actingAs($this->memberUser, 'sanctum')->putJson(
"/api/modules/sirsoft-board/boards/{$this->getTestBoardSlug()}/posts/{$postId}",
[
'title' => '상한 초과 첨부 수정',
'content' => '본문은 최소 길이를 넘겨야 검증을 통과합니다.',
'attachment_ids' => $attachmentIds,
]
);
$response->assertStatus(422);
$this->assertSame(0, Attachment::where('post_id', $postId)->count());
}
/**
* 상한 미설정(0) 게시판은 제한하지 않는다 (기존 동작 유지).
*/
@@ -0,0 +1,78 @@
/**
* 개별 게시판 수정 화면의 숫자 입력 경계값이 서버 한계값과 일치하는지 검증 (공개 이슈 #81).
*
* 결함: 같은 설정 항목이 두 화면에 있는데 경계 안내가 한쪽에만 있었다.
* - 게시판 환경설정(모듈 기본값): 숫자 입력에 허용 범위가 붙어 있음
* - 개별 게시판 수정: min/max 가 아예 없어 범위를 알 수 없음
* 저장은 서버가 동일하게 막으므로 잘못된 값이 들어가지는 않았지만, 사용자는 저장을
* 눌러 422 를 받아야만 범위를 알 수 있었다.
*
* 단위/정적:
* - modules/_bundled/sirsoft-board/resources/js/__tests__/layouts/board-form-range-contract.test.ts
* 가 레이아웃 JSON 의 표현식(_local.form._meta.limits.*)과 폴백 값을 전수 고정
* 이 spec 은 브라우저 수준 — 서버가 실제로 내려준 한계값이 DOM 속성으로 해석되는지를 담당한다.
* (표현식이 잘못된 경로를 가리켜도 폴백 값이 서버 기본치와 같으면 화면만 봐서는 구분되지
* 않으므로, 응답의 `_meta.limits` 를 읽어 그 값과 대조한다.)
*
* 시드 의존: 샘플 시드의 자유게시판(`free`).
*
* @scenario board-form-range-parity
* @axes screen=per_board screen=module_defaults
* @effects form_boundary_matches_server_limits
*/
import { test, expect, authenticatePage } from '../../fixtures/board-auth';
const SLUG = 'free';
/** 개별 게시판 화면의 입력 name → 서버 limits 키 prefix (per_page_mobile 은 per_page 범위 공유) */
const FIELD_TO_LIMIT: Record<string, string> = {
per_page: 'per_page',
per_page_mobile: 'per_page',
min_title_length: 'min_title_length',
max_title_length: 'max_title_length',
min_content_length: 'min_content_length',
max_content_length: 'max_content_length',
new_display_hours: 'new_display_hours',
min_comment_length: 'min_comment_length',
max_comment_length: 'max_comment_length',
max_comment_depth: 'max_comment_depth',
max_file_size: 'max_file_size',
max_file_count: 'max_file_count',
};
test('#81 - 개별 게시판 수정 화면의 숫자 경계값이 서버 한계값과 일치한다', async ({ page, boardManageToken }) => {
await authenticatePage(page, boardManageToken);
await page.goto(`/admin/boards/${SLUG}/edit`);
await expect(page.locator('input[name="per_page"]')).toBeAttached({ timeout: 20_000 });
// 서버가 실제로 내려주는 한계값을 그대로 읽는다 (화면 폴백과 구분하기 위함)
const limits = await page.evaluate(async ({ slug, bearer }) => {
const response = await fetch(
`/api/modules/sirsoft-board/admin/boards/form-data?board_slug=${slug}`,
{ headers: { Authorization: `Bearer ${bearer}`, Accept: 'application/json' } }
);
const body = await response.json();
return (body?.data?._meta?.limits ?? {}) as Record<string, number>;
}, { slug: SLUG, bearer: boardManageToken });
expect(
Object.keys(limits).length,
'게시판 한계값이 폼 데이터 응답에 실려 있지 않습니다 — 화면 바인딩이 영구히 폴백으로 떨어집니다.'
).toBeGreaterThan(0);
for (const [field, limitKey] of Object.entries(FIELD_TO_LIMIT)) {
const input = page.locator(`input[name="${field}"]`).first();
// 토글 뒤에 숨은 입력(예: 답글 사용)은 이 화면 기본 상태에서 렌더되지 않을 수 있다
if ((await input.count()) === 0) {
continue;
}
await expect(input, `${field}: min 이 서버 한계값과 다릅니다`)
.toHaveAttribute('min', String(limits[`${limitKey}_min`]));
await expect(input, `${field}: max 가 서버 한계값과 다릅니다`)
.toHaveAttribute('max', String(limits[`${limitKey}_max`]));
}
});
@@ -30,6 +30,7 @@
### Fixed
- 설정 화면의 선택 항목(라디오 버튼)을 키보드 방향키로 고를 때 선택이 저장되지 않던 문제를 수정했습니다. 마우스 클릭은 정상 동작했으나, 키보드만 사용하는 경우 화면 표시와 실제 저장 값이 어긋날 수 있었습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 로그인하지 않은 상태로 장바구니에 담아 둔 상품이 로그인 후 사라지던 문제를 수정했습니다. 로그인 시 장바구니를 회원 계정으로 옮기는 처리가 실행되지 않아, 담아 둔 상품이 아무 안내 없이 없어졌습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 설정 화면이 허용하는 값과 저장 규칙이 서로 달라 저장이 거부되거나 그 반대가 되던 항목들을 맞췄습니다. 리뷰 이미지 최대 개수(최대 20개), 리뷰 이미지 최대 크기(정수 MB, 최대 50MB), 마일리지 기본 적립률(최대 100%), 미입금 자동취소 기한(최소 1일 — 0일은 주문 즉시 만료라 사용할 수 없는 값)이 대상입니다. 정수만 받는 항목은 입력칸의 증감 단위도 1로 맞춰, 화살표로 값을 올리다 소수가 되어 저장이 거부되는 일이 없습니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
- 상품 고시정보 템플릿 목록에서 한 번에 가져올 개수에 상한(100개)을 두었습니다. 이전에는 임의의 큰 값을 넘겨 한 요청으로 전체 데이터를 가져갈 수 있었습니다. '전체' 조회는 종전대로 동작합니다. (#81 @jiwonpapa 님께서 제보해주셨습니다.)
@@ -0,0 +1,118 @@
/**
* 라디오 선택이 키보드로도 조작 가능한지 계약 테스트 (#493 후속)
*
* 배경: 라디오를 커스텀 스타일로 그리기 위해 `<Label>` 로 감싸고, 라디오 자체는
* `pointer-events-none` 으로 클릭을 통과시킨 뒤 Label 의 click 액션이 상태를 바꾼다.
*
* 결함: 이 구조에서 상태를 바꾸는 유일한 경로가 **click** 이다. 키보드 사용자는 라디오에
* 포커스를 두고 방향키로 항목을 옮기는데, 그때 발생하는 것은 click 이 아니라 change 다.
* 즉 화면상 선택 표시는 움직이는데 저장될 값은 따라오지 않는다 — 눈에 보이는 것과
* 저장되는 것이 어긋나므로 잘못된 값을 저장하고도 알 수 없다.
*
* 실측(2026-07-29, 마일리지 한도 설정): 마우스 클릭은 정상. 라디오 2개가 DOM 에
* 같은 `value` 로 렌더되는 것도 이 구조의 부산물이다(상태는 `checked` 바인딩이 결정).
*
* 회귀 차단 포인트:
* 1. 라디오는 클릭을 받을 수 있어야 한다 (`pointer-events-none` 금지).
* 2. 라디오 자신이 change 액션을 가져야 한다 — 키보드 조작의 유일한 신호다.
* 3. change 액션이 설정하는 값은 감싼 Label 의 click 액션과 같아야 한다
* (둘이 갈라지면 마우스와 키보드가 다른 값을 저장한다).
*/
import { describe, it, expect } from 'vitest';
import currencyCards from '../../../layouts/admin/partials/admin_ecommerce_settings/_tab_mileage_currency_cards.json';
import currencyTable from '../../../layouts/admin/partials/admin_ecommerce_settings/_tab_mileage_currency_table.json';
type Node = Record<string, unknown>;
/**
* 레이아웃 트리에서 radio 입력 노드와 그것을 감싼 액션 보유 조상을 모두 수집합니다.
*
* @param node 탐색 대상
* @param ancestor 현재까지의 최근접 액션 보유 조상
* @param out 수집 결과
* @returns 수집된 (radio, ancestor) 쌍 목록
*/
function collectRadios(
node: unknown,
ancestor: Node | null = null,
out: Array<{ node: Node; props: Node; ancestor: Node | null }> = []
): Array<{ node: Node; props: Node; ancestor: Node | null }> {
if (Array.isArray(node)) {
node.forEach((child) => collectRadios(child, ancestor, out));
return out;
}
if (node && typeof node === 'object') {
const current = node as Node;
const props = (current.props ?? {}) as Node;
if (props.type === 'radio') {
out.push({ node: current, props, ancestor });
}
const nextAncestor = Array.isArray(current.actions) ? current : ancestor;
Object.values(current).forEach((value) => collectRadios(value, nextAncestor, out));
}
return out;
}
/**
* 액션 목록에서 지정 이벤트 타입의 액션을 찾습니다.
*
* @param owner 액션 보유 노드
* @param type 이벤트 타입
* @returns 찾은 액션 (없으면 undefined)
*/
function actionOfType(owner: Node | null, type: string): Node | undefined {
const actions = (owner?.actions ?? []) as Node[];
return Array.isArray(actions) ? actions.find((a) => a.type === type) : undefined;
}
const layouts: Array<[string, unknown]> = [
['마일리지 통화 카드(모바일)', currencyCards],
['마일리지 통화 표(데스크탑)', currencyTable],
];
describe('라디오 키보드 조작 계약 (#493 후속)', () => {
it.each(layouts)('%s — 라디오가 클릭을 받을 수 있다', (_label, layout) => {
const radios = collectRadios(layout);
expect(radios.length, '라디오를 찾지 못했습니다 — 검사가 무력화됐습니다').toBeGreaterThan(0);
radios.forEach(({ props }) => {
expect(
String(props.className ?? ''),
`${props.name}: pointer-events-none 이면 키보드 포커스로 바꾼 값이 저장되지 않습니다`
).not.toContain('pointer-events-none');
});
});
it.each(layouts)('%s — 라디오가 change 액션을 가지고, 값이 Label 클릭과 같다', (_label, layout) => {
const radios = collectRadios(layout);
radios.forEach(({ node, props, ancestor }) => {
const change = actionOfType(node, 'change');
expect(
change,
`${props.name}: 라디오 자신에 change 액션이 없습니다 — 키보드 조작 신호를 받을 곳이 없습니다`
).toBeDefined();
const click = actionOfType(ancestor, 'click');
expect(click, `${props.name}: 감싼 요소의 click 액션을 찾지 못했습니다`).toBeDefined();
// 마우스와 키보드가 다른 값을 저장하면 조작 방법에 따라 결과가 갈린다
expect(
JSON.stringify(change?.params),
`${props.name}: change 와 click 이 서로 다른 값을 저장합니다`
).toBe(JSON.stringify(click?.params));
});
});
});
@@ -223,9 +223,20 @@
"name": "{{'mileage.currency_rules.' + rule._idx + '.max_use_type'}}",
"value": "percent",
"checked": "{{rule.max_use_type === 'percent'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.mileage.currency_rules": "{{(_local.form?.mileage?.currency_rules ?? []).map((c, i) => i === rule._idx ? { ...c, max_use_type: 'percent' } : c)}}",
"hasChanges": true
}
}
]
},
{
"type": "basic",
@@ -285,9 +296,20 @@
"name": "{{'mileage.currency_rules.' + rule._idx + '.max_use_type'}}",
"value": "fixed",
"checked": "{{rule.max_use_type === 'fixed'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.mileage.currency_rules": "{{(_local.form?.mileage?.currency_rules ?? []).map((c, i) => i === rule._idx ? { ...c, max_use_type: 'fixed' } : c)}}",
"hasChanges": true
}
}
]
},
{
"type": "basic",
@@ -485,9 +507,19 @@
"name": "newMileageCurrency.max_use_type",
"value": "percent",
"checked": "{{(_local.form?.newMileageCurrency?.max_use_type ?? 'percent') === 'percent'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.newMileageCurrency.max_use_type": "percent"
}
}
]
},
{
"type": "basic",
@@ -546,9 +578,19 @@
"name": "newMileageCurrency.max_use_type",
"value": "fixed",
"checked": "{{(_local.form?.newMileageCurrency?.max_use_type ?? 'percent') === 'fixed'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.newMileageCurrency.max_use_type": "fixed"
}
}
]
},
{
"type": "basic",
@@ -263,9 +263,20 @@
"name": "{{'mileage.currency_rules.' + rule._idx + '.max_use_type'}}",
"value": "percent",
"checked": "{{rule.max_use_type === 'percent'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.mileage.currency_rules": "{{(_local.form?.mileage?.currency_rules ?? []).map((c, i) => i === rule._idx ? { ...c, max_use_type: 'percent' } : c)}}",
"hasChanges": true
}
}
]
},
{
"type": "basic",
@@ -325,9 +336,20 @@
"name": "{{'mileage.currency_rules.' + rule._idx + '.max_use_type'}}",
"value": "fixed",
"checked": "{{rule.max_use_type === 'fixed'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.mileage.currency_rules": "{{(_local.form?.mileage?.currency_rules ?? []).map((c, i) => i === rule._idx ? { ...c, max_use_type: 'fixed' } : c)}}",
"hasChanges": true
}
}
]
},
{
"type": "basic",
@@ -574,9 +596,19 @@
"name": "newMileageCurrency.max_use_type",
"value": "percent",
"checked": "{{(_local.form?.newMileageCurrency?.max_use_type ?? 'percent') === 'percent'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.newMileageCurrency.max_use_type": "percent"
}
}
]
},
{
"type": "basic",
@@ -635,9 +667,19 @@
"name": "newMileageCurrency.max_use_type",
"value": "fixed",
"checked": "{{(_local.form?.newMileageCurrency?.max_use_type ?? 'percent') === 'fixed'}}",
"disabled": "{{_computed.isReadOnly}}",
"className": "pointer-events-none"
}
"disabled": "{{_computed.isReadOnly}}"
},
"actions": [
{
"type": "change",
"handler": "setState",
"if": "{{!_computed.isReadOnly}}",
"params": {
"target": "local",
"form.newMileageCurrency.max_use_type": "fixed"
}
}
]
},
{
"type": "basic",
@@ -4,6 +4,8 @@ namespace Modules\Sirsoft\Ecommerce\Services;
use App\Contracts\Extension\StorageInterface;
use App\Extension\HookManager;
use App\Support\ImageResizer;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
@@ -22,8 +24,8 @@ class CategoryImageService
/**
* CategoryImageService 생성자
*
* @param CategoryImageRepositoryInterface $repository 카테고리 이미지 리포지토리
* @param StorageInterface $storage 모듈 스토리지 드라이버
* @param CategoryImageRepositoryInterface $repository 카테고리 이미지 리포지토리
* @param StorageInterface $storage 모듈 스토리지 드라이버
*/
public function __construct(
private CategoryImageRepositoryInterface $repository,
@@ -36,11 +38,11 @@ class CategoryImageService
* category_id가 없는 경우 임시 업로드로 처리합니다.
* 임시 업로드된 이미지는 temp_key로 식별되며, 카테고리 저장 시 연결됩니다.
*
* @param UploadedFile $file 업로드된 파일
* @param int|null $categoryId 카테고리 ID (새 카테고리 생성 시 null)
* @param string $collection 컬렉션명
* @param string|null $tempKey 임시 업로드 키 (새 카테고리 생성 시 사용)
* @param array|null $altText 대체 텍스트 (다국어 배열)
* @param UploadedFile $file 업로드된 파일
* @param int|null $categoryId 카테고리 ID (새 카테고리 생성 시 null)
* @param string $collection 컬렉션명
* @param string|null $tempKey 임시 업로드 키 (새 카테고리 생성 시 사용)
* @param array|null $altText 대체 텍스트 (다국어 배열)
* @return CategoryImage 생성된 이미지
*/
public function upload(
@@ -51,7 +53,7 @@ class CategoryImageService
?array $altText = null
): CategoryImage {
// categoryId와 tempKey 모두 없으면 tempKey 자동 생성
if (!$categoryId && !$tempKey) {
if (! $categoryId && ! $tempKey) {
$tempKey = Str::uuid()->toString();
}
@@ -67,6 +69,9 @@ class CategoryImageService
$path = "category/{$datePath}/{$storedFilename}";
// 스토리지에 파일 저장 (category: 'images')
// 환경설정 > 업로드의 최대 가로/세로·품질 적용 (코어 설정이 모든 업로드 경로에 동일 적용)
app(ImageResizer::class)->resizeInPlace($file->getRealPath(), $file->getMimeType());
$this->storage->put('images', $path, file_get_contents($file->getRealPath()));
// Disk 정보는 스토리지 드라이버에서 가져옴
@@ -123,8 +128,8 @@ class CategoryImageService
/**
* 임시 이미지를 카테고리에 연결합니다.
*
* @param string $tempKey 임시 업로드 키
* @param int $categoryId 카테고리 ID
* @param string $tempKey 임시 업로드 키
* @param int $categoryId 카테고리 ID
* @return int 연결된 이미지 수
*/
public function linkTempImages(string $tempKey, int $categoryId): int
@@ -135,9 +140,9 @@ class CategoryImageService
/**
* 임시 이미지 목록을 조회합니다.
*
* @param string $tempKey 임시 업로드 키
* @param string|null $collection 컬렉션 필터
* @return \Illuminate\Database\Eloquent\Collection
* @param string $tempKey 임시 업로드 키
* @param string|null $collection 컬렉션 필터
* @return Collection
*/
public function getTempImages(string $tempKey, ?string $collection = null)
{
@@ -147,7 +152,7 @@ class CategoryImageService
/**
* 해시로 이미지 조회
*
* @param string $hash 이미지 해시
* @param string $hash 이미지 해시
* @return CategoryImage|null 이미지 또는 null
*/
public function getByHash(string $hash): ?CategoryImage
@@ -158,7 +163,7 @@ class CategoryImageService
/**
* 이미지 다운로드 응답 생성
*
* @param string $hash 이미지 해시 (12자)
* @param string $hash 이미지 해시 (12자)
* @return StreamedResponse|null 이미지 스트림 또는 없을 경우 null
*/
public function download(string $hash): ?StreamedResponse
@@ -195,7 +200,7 @@ class CategoryImageService
/**
* 이미지 삭제
*
* @param int $id 이미지 ID
* @param int $id 이미지 ID
* @return bool 삭제 성공 여부
*/
public function delete(int $id): bool
@@ -242,7 +247,7 @@ class CategoryImageService
/**
* 순서 변경
*
* @param array<int, int> $orders 이미지 ID => sort_order 매핑
* @param array<int, int> $orders 이미지 ID => sort_order 매핑
* @return bool 성공 여부
*/
public function reorder(array $orders): bool
@@ -261,8 +266,8 @@ class CategoryImageService
/**
* 삭제 후 남은 이미지들의 순서를 재정렬합니다.
*
* @param int $categoryId 카테고리 ID
* @param string $collection 컬렉션명
* @param int $categoryId 카테고리 ID
* @param string $collection 컬렉션명
*/
protected function reorderAfterDelete(int $categoryId, string $collection): void
{
@@ -281,9 +286,9 @@ class CategoryImageService
/**
* 카테고리의 이미지 목록을 조회합니다.
*
* @param int $categoryId 카테고리 ID
* @param string|null $collection 컬렉션 필터
* @return \Illuminate\Database\Eloquent\Collection
* @param int $categoryId 카테고리 ID
* @param string|null $collection 컬렉션 필터
* @return Collection
*/
public function getImages(int $categoryId, ?string $collection = null)
{
@@ -295,8 +300,7 @@ class CategoryImageService
*
* 카테고리 저장 실패 시 업로드된 이미지들을 정리하기 위해 사용됩니다.
*
* @param array<int> $imageIds 이미지 ID 배열
* @return void
* @param array<int> $imageIds 이미지 ID 배열
*/
public function rollbackUploadedImages(array $imageIds): void
{
@@ -308,8 +312,8 @@ class CategoryImageService
/**
* 이미지 정보 업데이트 (대체 텍스트 등)
*
* @param int $id 이미지 ID
* @param array $data 업데이트할 데이터
* @param int $id 이미지 ID
* @param array $data 업데이트할 데이터
* @return CategoryImage 업데이트된 이미지
*/
public function update(int $id, array $data): CategoryImage
@@ -4,6 +4,7 @@ namespace Modules\Sirsoft\Ecommerce\Services;
use App\Contracts\Extension\StorageInterface;
use App\Extension\HookManager;
use App\Support\ImageResizer;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
@@ -84,6 +85,9 @@ class ProductImageService
}
// 스토리지에 파일 저장 (category: 'images')
// 환경설정 > 업로드의 최대 가로/세로·품질 적용 (코어 설정이 모든 업로드 경로에 동일 적용)
app(ImageResizer::class)->resizeInPlace($file->getRealPath(), $file->getMimeType());
$this->storage->put('images', $path, file_get_contents($file->getRealPath()));
// Disk 정보는 스토리지 드라이버에서 가져옴
@@ -4,6 +4,7 @@ namespace Modules\Sirsoft\Ecommerce\Services;
use App\Contracts\Extension\StorageInterface;
use App\Extension\HookManager;
use App\Support\ImageResizer;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
@@ -60,6 +61,9 @@ class ProductReviewImageService
$storedFilename = Str::uuid().'.'.$file->getClientOriginalExtension();
$path = "reviews/{$review->id}/{$storedFilename}";
// 환경설정 > 업로드의 최대 가로/세로·품질 적용 (코어 설정이 모든 업로드 경로에 동일 적용)
app(ImageResizer::class)->resizeInPlace($file->getRealPath(), $file->getMimeType());
$this->storage->put('images', $path, file_get_contents($file->getRealPath()));
$disk = $this->storage->getDisk();
@@ -4,6 +4,7 @@ namespace Modules\Sirsoft\Page\Services;
use App\Contracts\Extension\StorageInterface;
use App\Extension\HookManager;
use App\Support\ImageResizer;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\UploadedFile;
@@ -95,6 +96,10 @@ class PageAttachmentService
$path = 'temp/'.$tempKey.'/'.$storedFilename;
}
// 환경설정 > 업로드의 최대 가로/세로·품질을 적용한다 (코어 설정이 모든 업로드 경로에 동일 적용).
// 임시 파일을 제자리에서 줄이므로 아래의 저장·크기 계산이 모두 축소본을 본다.
app(ImageResizer::class)->resizeInPlace($file->getRealPath(), $file->getMimeType());
// StorageInterface를 통한 파일 저장
$this->storage->put('attachments', $path, file_get_contents($file->getRealPath()));