mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-26 04:19:49 +03:00
fixed undefined bug with ends with any
This commit is contained in:
parent
0c05c9ac75
commit
c9ee940a94
@ -33,4 +33,11 @@ export const generateNumberByStep = ({ min, max, step = 1 }) => {
|
||||
return numbers[randomIndex];
|
||||
};
|
||||
|
||||
export const endsWithAny = (options, string) => options.some((option) => string.endsWith(option));
|
||||
export const endsWithAny = (options, string) =>
|
||||
options.some((option) => {
|
||||
if (string) {
|
||||
return string.endsWith(option);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -198,7 +198,9 @@ export default class SlateMediaObjectPreview extends React.Component {
|
||||
style={{ color: Constants.system.textGray }}
|
||||
/>
|
||||
);
|
||||
|
||||
if (!file.filename) {
|
||||
console.log(file);
|
||||
}
|
||||
if (endsWithAny([".ttf", ".otf", ".woff", ".woff2"], file.filename)) {
|
||||
return (
|
||||
<article
|
||||
|
@ -136,7 +136,7 @@ export default async (req, res) => {
|
||||
|
||||
let key = bucketRoot.key;
|
||||
let encryptedBucketName = null;
|
||||
if (user.data.settings.allow_encrypted_data_storage || req.body.data.forceEncryption) {
|
||||
if (user.data.settings?.allow_encrypted_data_storage || req.body.data.forceEncryption) {
|
||||
encryptedBucketName = req.body.data.forceEncryption
|
||||
? `encrypted-deal-${uuid()}`
|
||||
: `encrypted-data-${uuid()}`;
|
||||
|
@ -44,9 +44,9 @@ const printUsersTable = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(Object.keys(dataParams));
|
||||
console.log(Object.keys(fileParams));
|
||||
console.log(Object.keys(coverParams));
|
||||
console.log({ dataParams: Object.keys(dataParams) });
|
||||
console.log({ fileParams: Object.keys(fileParams) });
|
||||
console.log({ coverParams: Object.keys(coverParams) });
|
||||
};
|
||||
|
||||
const printSlatesTable = async () => {
|
||||
@ -78,22 +78,22 @@ const printSlatesTable = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(Object.keys(dataParams));
|
||||
console.log(Object.keys(fileParams));
|
||||
console.log(Object.keys(coverParams));
|
||||
console.log({ dataParams: Object.keys(dataParams) });
|
||||
console.log({ fileParams: Object.keys(fileParams) });
|
||||
console.log({ coverParams: Object.keys(coverParams) });
|
||||
};
|
||||
|
||||
// MARK: - add/modify tables
|
||||
|
||||
const addTables = async () => {
|
||||
await DB.schema.table("deals", function (table) {
|
||||
table.renameColumn("owner_user_id", "ownerId"); //replaced
|
||||
table.renameColumn("owner_user_id", "ownerId");
|
||||
table.renameColumn("created_at", "createdAt");
|
||||
table.renameColumn("updated_at", "updatedAt"); //replaced
|
||||
table.renameColumn("updated_at", "updatedAt");
|
||||
});
|
||||
|
||||
await DB.schema.table("keys", function (table) {
|
||||
table.renameColumn("owner_id", "ownerId"); //replaced
|
||||
table.renameColumn("owner_id", "ownerId");
|
||||
table.renameColumn("created_at", "createdAt");
|
||||
});
|
||||
|
||||
@ -170,10 +170,6 @@ const addTables = async () => {
|
||||
|
||||
// MARK: - populate new tables
|
||||
|
||||
//strip out the "data-" in the id so it can be a uuid
|
||||
//if there's a file with that id already existing, this is probably a save copy instance. So give this one a new id
|
||||
//when matching slate fiels to files, if you can't find it by id, match it by cid and ownerId. should only be one match.
|
||||
|
||||
const migrateUsersTable = async (testing = false) => {
|
||||
const users = await DB.select("*").from("users");
|
||||
let count = 0;
|
||||
@ -542,11 +538,11 @@ const runScript = async () => {
|
||||
// await wipeNewTables();
|
||||
|
||||
//NOTE(martina): before starting, make sure you have all the parameters accounted for
|
||||
// await printUsersTable()
|
||||
// await printSlatesTable()
|
||||
await printUsersTable();
|
||||
await printSlatesTable();
|
||||
|
||||
//NOTE(martina): add tables
|
||||
await addTables();
|
||||
// await addTables();
|
||||
|
||||
//NOTE(martina): put data into new tables
|
||||
let testing = false;
|
||||
|
Loading…
Reference in New Issue
Block a user