Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/v1/routers/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ async def api_download_file(
- **wr_id**: 게시글 아이디
- **bf_no**: 첨부된 파일의 순번
"""
service.validate_download_access()
service.validate_download_level()
board_file = service.get_board_file()
service.validate_point(board_file)
Expand Down
1 change: 1 addition & 0 deletions bbs/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ async def download_file(
Returns:
FileResponse: 파일 다운로드
"""
service.validate_download_access()
service.validate_download_level()
board_file = service.get_board_file()
service.validate_point_session(board_file)
Expand Down
7 changes: 7 additions & 0 deletions service/board/read_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ def validate_download_level(self):
if not self.is_download_level():
self.raise_exception(detail="다운로드 권한이 없습니다.", status_code=403)

def validate_download_access(self):
"""첨부파일 다운로드 전 게시글 접근 권한(읽기/비밀글/댓글) 검증"""
self.block_read_comment()
self.validate_read_level()
# 다운로드 경로에서도 비밀글 접근 제어를 강제한다.
self.validate_secret()

def get_board_file(self) -> BoardFile:
"""파일 정보 조회"""
board_file = self.file_service.get_board_file(self.bo_table, self.wr_id, self.bf_no)
Expand Down