Skip to content

Commit b19b375

Browse files
committed
fix: getbucket was deleted unintentionally - now retrived
1 parent 7426d18 commit b19b375

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

backend/controllers/project.controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { getCompiledModel } = require("../utils/injectModel")
1414
const QueryEngine = require("../utils/queryEngine");
1515
const { storageRegistry } = require("../utils/registry");
1616
const { deleteProjectByApiKeyCache, setProjectById, getProjectById, deleteProjectById } = require("../services/redisCaching");
17-
const { isProjectStorageExternal, isProjectDbExternal } = require("../utils/project.helpers");
17+
const { isProjectStorageExternal, isProjectDbExternal, getBucket } = require("../utils/project.helpers");
1818
const { v4: uuidv4 } = require('uuid');
1919
const { getPublicIp } = require("../utils/network");
2020

@@ -596,7 +596,8 @@ module.exports.listFiles = async (req, res) => {
596596

597597
res.json(files);
598598
} catch (err) {
599-
res.status(500).json({ error: err.message });
599+
console.error(err);
600+
res.status(500).json({ error: "Something Went Wrong", try: "Try checking docs or contact support - urbackend@bitbros.in" });
600601
}
601602
};
602603

backend/utils/project.helpers.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ const isProjectDbExternal = (project) => {
2020
return !!project.resources?.db?.isExternal;
2121
};
2222

23+
24+
/**
25+
* Get the bucket name for the project
26+
* @param {Object} project - The project object
27+
* @returns {String}
28+
*/
29+
const getBucket = (project) =>
30+
project.resources?.storage?.isExternal ? "files" : "dev-files";
31+
32+
2333
module.exports = {
2434
isProjectStorageExternal,
25-
isProjectDbExternal
35+
isProjectDbExternal,
36+
getBucket
2637
};

0 commit comments

Comments
 (0)