U
    i                     @   s`   d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 edgdZ
e
ded	d
dZdS )zPublic endpoint for serving portfolio attachment files.

Registered WITHOUT JWT dependency in main.py.
Security: filenames are UUID hex strings (not guessable).
Nginx basic-auth still covers the full site on production.
    N)	APIRouterHTTPExceptionstatus)FileResponse)get_full_pathzportfolio-files)tagsz%/api/portfolio/attachments/{filename}filenamec                    sT   d| ksd| ksd| kr&t tjddt| }tj|sHt tjddt|| dS )N/z..\zInvalid filename)status_codedetailzFile not foundr   )	r   r   HTTP_400_BAD_REQUESTr   ospathexistsHTTP_404_NOT_FOUNDr   )r	   r    r   A/var/www/html/me.goteku.com/backend/app/routes/portfolio_files.pyserve_portfolio_attachment   s    r   )__doc__r   fastapir   r   r   fastapi.responsesr   app.helpers.file_storager   routergetstrr   r   r   r   r   <module>   s   