mirror of
https://github.com/rowyio/rowy.git
synced 2026-07-12 21:39:28 +02:00
FT_compressedThumbnail: add path exclusions
This commit is contained in:
@@ -17,9 +17,15 @@ import config from "../functionConfig";
|
||||
const SUPPORTED_TYPES = ["image/jpeg", "image/png"];
|
||||
const DEFAULT_SIZES = ["400x400", "200x200", "100x100"];
|
||||
const sizes =
|
||||
Array.isArray(config) && typeof config[0] === "string"
|
||||
? config
|
||||
config && Array.isArray(config.sizes) && typeof config.sizes[0] === "string"
|
||||
? config.sizes
|
||||
: DEFAULT_SIZES;
|
||||
const excludePaths =
|
||||
config &&
|
||||
Array.isArray(config.excludes) &&
|
||||
typeof config.excludes[0] === "string"
|
||||
? config.excludes
|
||||
: [];
|
||||
|
||||
export const FT_compressedThumbnail = functions.storage
|
||||
.object()
|
||||
@@ -43,6 +49,14 @@ export const FT_compressedThumbnail = functions.storage
|
||||
const token = object.metadata?.firebaseStorageDownloadTokens;
|
||||
|
||||
const filePath = object.name!;
|
||||
|
||||
// Check if file should be excluded based off path
|
||||
for (const excludePath of excludePaths)
|
||||
if (filePath.startsWith(excludePath)) {
|
||||
console.log("File excluded from path", excludePath);
|
||||
return null;
|
||||
}
|
||||
|
||||
const baseFileName = path.basename(filePath, path.extname(filePath));
|
||||
const tempLocalFile = path.join(
|
||||
os.tmpdir(),
|
||||
|
||||
@@ -1,15 +1,2 @@
|
||||
export default {
|
||||
onUpdate: true,
|
||||
onCreate: false,
|
||||
source: "advisors",
|
||||
fieldsToSync: [
|
||||
"firstName",
|
||||
"lastName",
|
||||
"preferredName",
|
||||
"profilePhoto",
|
||||
"email",
|
||||
"location",
|
||||
],
|
||||
target: "coaches",
|
||||
};
|
||||
export default {} as any;
|
||||
export const collectionPath = "";
|
||||
|
||||
Reference in New Issue
Block a user