diff --git a/packages/core/app/client/.umirc.ts b/packages/core/app/client/.umirc.ts index 5bdd20fff8..48ec5e9dd4 100644 --- a/packages/core/app/client/.umirc.ts +++ b/packages/core/app/client/.umirc.ts @@ -24,6 +24,7 @@ export default defineConfig({ content: isDevCmd ? ` window['__nocobase_public_path__'] = "${process.env.APP_PUBLIC_PATH || '/'}"; + window['__nocobase_dev_public_path__'] = "/"; ` : ` window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}'; diff --git a/packages/core/client/src/schema-component/antd/upload/placeholder.ts b/packages/core/client/src/schema-component/antd/upload/placeholder.ts index b5a25bb4ac..f863f9e918 100644 --- a/packages/core/client/src/schema-component/antd/upload/placeholder.ts +++ b/packages/core/client/src/schema-component/antd/upload/placeholder.ts @@ -7,6 +7,8 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ +const publicPath = window['__nocobase_dev_public_path__'] || window['__nocobase_public_path__'] || '/'; + export const UPLOAD_PLACEHOLDER = [ { ext: /\.docx?$/i, @@ -64,6 +66,11 @@ export const UPLOAD_PLACEHOLDER = [ ext: /\.(zip|rar|arj|z|gz|iso|jar|ace|tar|uue|dmg|pkg|lzh|cab)$/i, icon: '/file-placeholder/zip-200-200.png', }, -]; +].map((item) => { + return { + ext: item.ext, + icon: publicPath + item.icon.slice(1), + }; +}); -export const UNKNOWN_FILE_ICON = '/file-placeholder/unknown-200-200.png'; +export const UNKNOWN_FILE_ICON = publicPath + 'file-placeholder/unknown-200-200.png';