Refactor publish and validation and servability for all file types #902

Merged
jessopb merged 2 commits from refactorPublishValidate into master 2019-02-09 21:41:07 +01:00
jessopb commented 2019-02-06 19:13:29 +01:00 (Migrated from github.com)

This one will probably have breaking changes when deployed unless:

  • site/custom/scss _variables is manually updated, and
  • cli/defaults/siteConfig is manually updated to /site/config/siteConfig

Improvements made:

  • more granular file size limit settings
  • no more hardcoded type restrictions
  • chainquery correctly assigns extensions in an extensible way

Todo: conditionally don't try to find file dimensions.

This one will probably have breaking changes when deployed unless: - site/custom/scss _variables is manually updated, and - cli/defaults/siteConfig is manually updated to /site/config/siteConfig Improvements made: - more granular file size limit settings - no more hardcoded type restrictions - chainquery correctly assigns extensions in an extensible way Todo: conditionally don't try to find file dimensions.
kauffj commented 2019-02-06 19:16:28 +01:00 (Migrated from github.com)

It may make sense to look at adding versioning and a (crude) migration framework. I added to agenda for later today.

It may make sense to look at adding versioning and a (crude) migration framework. I added to agenda for later today.
skhameneh (Migrated from github.com) requested changes 2019-02-07 04:06:49 +01:00
skhameneh (Migrated from github.com) commented 2019-02-07 04:00:21 +01:00

Please use (for legibility):

} else {
   return mime.extension(this.content_type) ? mime.extension(this.content_type) : 'jpg';
}
Please use (for legibility): ``` } else { return mime.extension(this.content_type) ? mime.extension(this.content_type) : 'jpg'; } ```
skhameneh (Migrated from github.com) commented 2019-02-07 04:00:47 +01:00

Remove?

Remove?
skhameneh (Migrated from github.com) commented 2019-02-07 04:05:09 +01:00

Can make an object of { [mediaType]: maxSize }, which would map to:

let mediaTypeLimit = mediaTypeLimits[mediaType] || false;
if (mediaTypeLimit) {
  if (file.size > mediaTypeLimit) {
    throw new Error(`Sorry, type ${mediaType} is limited to ${mediaTypeLimit / SIZE_MB} MB.`);
  }
}
Can make an object of `{ [mediaType]: maxSize }`, which would map to: ``` let mediaTypeLimit = mediaTypeLimits[mediaType] || false; if (mediaTypeLimit) { if (file.size > mediaTypeLimit) { throw new Error(`Sorry, type ${mediaType} is limited to ${mediaTypeLimit / SIZE_MB} MB.`); } } ```
skhameneh (Migrated from github.com) commented 2019-02-07 04:06:31 +01:00

Much of this is duplicated in the other file I commented.

Much of this is duplicated in the other file I commented.
jessopb (Migrated from github.com) reviewed 2019-02-09 21:35:51 +01:00
jessopb (Migrated from github.com) commented 2019-02-09 21:35:50 +01:00

Done and DRY.

Done and DRY.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/spee.ch#902
No description provided.