Skip to content

Commit

Permalink
fix more
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphm committed Dec 26, 2024
1 parent 23b570a commit db03eb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/atoms/BlobUploaderV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import clsx from 'clsx';
import React, { ReactElement, useCallback, useEffect, useMemo, useState } from 'react';
import { useFormContext } from 'react-hook-form';
import { API } from 'requests/api';
import { LIMIT_FILE_UPLOAD } from 'types/constants';
import { BASE_URL, LIMIT_FILE_UPLOAD } from 'types/constants';
import { useTrans } from 'utils/i18next';
import { UploadProvider, isImage } from 'utils/media';
import { truncateMiddle } from 'utils/text';
Expand Down Expand Up @@ -108,7 +108,12 @@ export const BlobUploaderV2 = ({ name = '', selectedMedia }: Props) => {
const FileProvider = ({ children }: { children: ReactElement }) => {
if (fileName)
return (
<a download={fileName} target="_self" href={'/api/upload?fileName=' + fileName}>
<a
download={fileName}
ref={BASE_URL}
referrerPolicy="same-origin"
target="_self"
href={'/api/upload?fileName=' + fileName}>
{children}
</a>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/atoms/BlobViewerV2.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Media } from '@prisma/client';
import { File, Image as ImageIcon } from '@styled-icons/feather';
import clsx from 'clsx';
import { BASE_URL } from 'types/constants';
import { isImage } from 'utils/media';
import { truncateMiddle } from 'utils/text';

Expand All @@ -10,6 +11,8 @@ export const BlobViewerV2 = ({ media }: { media: Media }) => {
<a
download={media.name}
target="_self"
ref={BASE_URL}
referrerPolicy="same-origin"
href={`/api/upload?fileName=${media.name}`}
className="flex cursor-pointer items-center gap-1 text-gray-500 hover:text-gray-900">
<div
Expand Down

0 comments on commit db03eb8

Please sign in to comment.