Update productsFileService.js

This commit is contained in:
Gilles Lazures 2026-02-02 04:48:24 +01:00
parent 4e70d59c63
commit 33482e0b41

View File

@ -60,7 +60,7 @@ async function getProductFiles(productName, platform) {
async function getFile(basePath, productName, productPlatform) { async function getFile(basePath, productName, productPlatform) {
try { try {
const fixedPath = path.join(productsDataPath, productName, productPlatform, decodeURI(basePath)) const fixedPath = path.join(productsDataPath, productName, "files", productPlatform, decodeURI(basePath))
const fileMetadata = await fs.promises.stat(fixedPath) const fileMetadata = await fs.promises.stat(fixedPath)
if (fileMetadata.isDirectory()) { if (fileMetadata.isDirectory()) {
throw new DefaultError(409, "Can't download a directory", "", "NotDownloadableException") throw new DefaultError(409, "Can't download a directory", "", "NotDownloadableException")
@ -76,8 +76,8 @@ async function getFile(basePath, productName, productPlatform) {
} }
} }
async function canAccess(productName, productPlatform) { async function canAccess(productName) {
const fixedPath = path.join(productsDataPath, productName, productPlatform, ".brikcfg") const fixedPath = path.join(productsDataPath, productName, "files", ".brikcfg")
const fileState = await fs.promises.exists(fixedPath, fs.constants.F_OK) const fileState = await fs.promises.exists(fixedPath, fs.constants.F_OK)
if (!fileState) { if (!fileState) {
return { code: 200 } return { code: 200 }