|
@@ -1,4 +1,4 @@
|
|
|
-import { useTranslation } from 'react-i18next'
|
|
|
|
|
|
|
+import { useTranslation, Trans } from 'react-i18next'
|
|
|
import { FetchError } from '../../../../infrastructure/fetch-json'
|
|
import { FetchError } from '../../../../infrastructure/fetch-json'
|
|
|
import RedirectToLogin from './redirect-to-login'
|
|
import RedirectToLogin from './redirect-to-login'
|
|
|
import {
|
|
import {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
InvalidFilenameError,
|
|
InvalidFilenameError,
|
|
|
} from '../../errors'
|
|
} from '../../errors'
|
|
|
import DangerMessage from './danger-message'
|
|
import DangerMessage from './danger-message'
|
|
|
|
|
+import getMeta from '@/utils/meta'
|
|
|
|
|
|
|
|
// TODO: Update the error type when we properly type FileTreeActionableContext
|
|
// TODO: Update the error type when we properly type FileTreeActionableContext
|
|
|
export default function ErrorMessage({
|
|
export default function ErrorMessage({
|
|
@@ -15,6 +16,7 @@ export default function ErrorMessage({
|
|
|
error: string | Record<string, any>
|
|
error: string | Record<string, any>
|
|
|
}) {
|
|
}) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
+ const { isOverleaf } = getMeta('ol-ExposedSettings')
|
|
|
const fileNameLimit = 150
|
|
const fileNameLimit = 150
|
|
|
|
|
|
|
|
// the error is a string
|
|
// the error is a string
|
|
@@ -46,6 +48,22 @@ export default function ErrorMessage({
|
|
|
</DangerMessage>
|
|
</DangerMessage>
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ case 'invalid_upload_request':
|
|
|
|
|
+ if (!isOverleaf) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <DangerMessage>{t('generic_something_went_wrong')}</DangerMessage>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ return (
|
|
|
|
|
+ <DangerMessage>
|
|
|
|
|
+ <Trans
|
|
|
|
|
+ i18nKey="invalid_upload_request"
|
|
|
|
|
+ // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
|
|
|
|
|
+ components={[<a href="/contact" target="_blank" />]}
|
|
|
|
|
+ />
|
|
|
|
|
+ </DangerMessage>
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
case 'duplicate_file_name':
|
|
case 'duplicate_file_name':
|
|
|
return (
|
|
return (
|
|
|
<DangerMessage>
|
|
<DangerMessage>
|