Fixes #4565 - assets directory conflicts with assets API when the webserver is nginx

Signed-off-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
Andras Timar 2025-08-08 17:43:05 +02:00 committed by Elizabeth Danzberger
parent 1f268dada7
commit a79476128f
No known key found for this signature in database
GPG key ID: D64CE07FD0188C79
7 changed files with 8 additions and 8 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2016 ownCloud, Inc.
# SPDX-License-Identifier: AGPL-3.0-or-later
/assets/fonts
/fonts
tests/clover.xml
.idea
node_modules/

View file

@ -6,7 +6,7 @@ SPDX-PackageSupplier = "Nextcloud <info@nextcloud.com>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/richdocuments"
[[annotations]]
path = [".gitattributes", ".github/issue_template.md", ".github/CODEOWNERS", ".editorconfig", "package-lock.json", "package.json", "composer.json", "composer.lock", "**/composer.json", "**/composer.lock", ".l10nignore", "cypress/tsconfig.json", "vendor-bin/**/composer.json", "vendor-bin/**/composer.lock", ".tx/config", "tsconfig.json", "js/vendor.LICENSE.txt", "krankerl.toml", ".npmignore", ".nextcloudignore", ".eslintrc.json", ".tx/backport", "assets/fonts/.gitkeep"]
path = [".gitattributes", ".github/issue_template.md", ".github/CODEOWNERS", ".editorconfig", "package-lock.json", "package.json", "composer.json", "composer.lock", "**/composer.json", "**/composer.lock", ".l10nignore", "cypress/tsconfig.json", "vendor-bin/**/composer.json", "vendor-bin/**/composer.lock", ".tx/config", "tsconfig.json", "js/vendor.LICENSE.txt", "krankerl.toml", ".npmignore", ".nextcloudignore", ".eslintrc.json", ".tx/backport", "fonts/.gitkeep"]
precedence = "aggregate"
SPDX-FileCopyrightText = "none"
SPDX-License-Identifier = "CC0-1.0"

View file

@ -1,6 +1,6 @@
#!/bin/bash
#
# Download font files and put them into the assets/fonts folder for the release
# Download font files and put them into the fonts folder for the release
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
FONTLIST=(
@ -22,20 +22,20 @@ FONTLIST=(
"https://github.com/google/fonts/raw/main/ofl/spectral/Spectral-Regular.ttf"
)
rm assets/fonts/*
rm fonts/*
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
for font in "${FONTLIST[@]}"; do
echo "$font"
wget -q -P assets/fonts/ $font
wget -q -P fonts/ $font
FILENAME=$(urldecode "$(basename "$font")")
if [[ $FILENAME == *"wght"* ]]; then
NEWFILENAME=$(echo $FILENAME | sed 's/\[wght\]/-wght/g')
NEWFILENAME=$(echo $NEWFILENAME | sed 's/\[wdth,wght\]/-wdtg-wght/g')
mv assets/fonts/$FILENAME assets/fonts/$NEWFILENAME
mv fonts/$FILENAME fonts/$NEWFILENAME
else
NEWFILENAME=$(echo $FILENAME)
fi
@ -44,5 +44,5 @@ for font in "${FONTLIST[@]}"; do
FONTNAME=$(echo $NEWFILENAME | sed 's/.ttf//g')
echo "$(dirname $font)/OFL.txt"
wget -q -O "assets/fonts/$FONTNAME.LICENSE.txt" "$(dirname $font)/OFL.txt"
wget -q -O "fonts/$FONTNAME.LICENSE.txt" "$(dirname $font)/OFL.txt"
done

View file

@ -213,7 +213,7 @@ class FontService {
* @throws Exception
*/
public function installDefaultFonts(): void {
$dirPath = __DIR__ . '/../../assets/fonts';
$dirPath = __DIR__ . '/../../fonts';
if (!is_dir($dirPath)) {
throw new Exception("Directory \"$dirPath\" does not exist!");