Skip to content

Commit

Permalink
Fixed download bug in details tab (#728)
Browse files Browse the repository at this point in the history
* removed fixed domain, added missing translations

* build files

* Automatic frontend build

---------

Co-authored-by: Corepex <[email protected]>
  • Loading branch information
Corepex and Corepex authored Nov 21, 2024
1 parent 923eb1f commit 7616ace
Show file tree
Hide file tree
Showing 22 changed files with 2,092 additions and 13 deletions.
8 changes: 0 additions & 8 deletions assets/js/src/core/app/api/pimcore/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

export function getDomain (): string {
return 'http://localhost'
}

export function getPrefix (): string {
return '/pimcore-studio/api'
}

export function getDomainWithPrefix (): string {
return `${getDomain()}${getPrefix()}`
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@Pimcore/modules/asset/editor/types/image/tab-manager/tabs/preview/sidebar/tabs/details/details-view'
import { replaceFileEnding, saveFileLocal } from '@Pimcore/utils/files'
import { buildQueryString } from '@Pimcore/utils/query-string'
import { getDomainWithPrefix } from '@Pimcore/app/api/pimcore/route'
import { getPrefix } from '@Pimcore/app/api/pimcore/route'

const DetailContainer = (): React.JSX.Element => {
const assetContext = useContext(AssetContext)
Expand Down Expand Up @@ -78,7 +78,7 @@ const DetailContainer = (): React.JSX.Element => {

const queryString = buildQueryString(keyValues, ['', '-1'])

fetch(`http://localhost/pimcore-studio/api/assets/${id}/image/download/custom?${queryString}`)
fetch(`${getPrefix()}/assets/${id}/image/download/custom?${queryString}`)
.then(async (response) => await response.blob())
.then((imageBlob) => {
const imageURL = URL.createObjectURL(imageBlob)
Expand All @@ -91,10 +91,10 @@ const DetailContainer = (): React.JSX.Element => {

function downloadImageByFormat (id: number, format: string): void {
if (format === 'original') {
prepareDownload(`${getDomainWithPrefix()}/assets/${id}/download`, format)
prepareDownload(`${getPrefix()}/assets/${id}/download`, format)
return
}
prepareDownload(`${getDomainWithPrefix()}/assets/${id}/image/download/format/${format}`, format)
prepareDownload(`${getPrefix()}/assets/${id}/image/download/format/${format}`, format)
}

function prepareDownload (url: string, format: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const AssetEditorSidebarDetailsView = ({
const CUSTOM_DOWNLOAD_OPTIONS = [
{
key: 1,
title: <span>Custom Download</span>,
title: <span>{t('image-sidebar.tab.details.custom-download')}</span>,
children: (
<Form
initialValues={ {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"entrypoints": {
"main": {
"js": [
"/bundles/pimcorestudioui/build/a5964510-ca8c-4662-b3c3-781d86b4efc2/main.js"
]
}
}
}
2 changes: 2 additions & 0 deletions public/build/a5964510-ca8c-4662-b3c3-781d86b4efc2/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*!
*
* /**
* * Pimcore
* *
* * This source file is available under two different licenses:
* * - Pimcore Open Core License (POCL)
* * - Pimcore Commercial License (PCL)
* * Full copyright and license information is available in
* * LICENSE.md which is distributed with this source code.
* *
* * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* * @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
* * /
*
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bundles/pimcorestudioui/build/a5964510-ca8c-4662-b3c3-781d86b4efc2/main.js": "/bundles/pimcorestudioui/build/a5964510-ca8c-4662-b3c3-781d86b4efc2/main.js"
}
2 changes: 2 additions & 0 deletions public/build/c218197e-864b-4a49-9acc-3584d5efe721/947.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*!
*
* /**
* * Pimcore
* *
* * This source file is available under two different licenses:
* * - Pimcore Open Core License (POCL)
* * - Pimcore Commercial License (PCL)
* * Full copyright and license information is available in
* * LICENSE.md which is distributed with this source code.
* *
* * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* * @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
* * /
*
*/
16 changes: 16 additions & 0 deletions public/build/c218197e-864b-4a49-9acc-3584d5efe721/core-dll.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions public/build/c218197e-864b-4a49-9acc-3584d5efe721/core-dll.js

Large diffs are not rendered by default.

Loading

0 comments on commit 7616ace

Please sign in to comment.