From 89ae795b220a91512563558440586ddd17c16f63 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 25 Jul 2017 00:49:40 -0700 Subject: [PATCH] added file extensions to the share links --- controllers/showController.js | 3 +++ routes/serve-routes.js | 2 +- views/partials/assetInfo.handlebars | 14 +++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/controllers/showController.js b/controllers/showController.js index 5f1ac3fd..78ef27bf 100644 --- a/controllers/showController.js +++ b/controllers/showController.js @@ -28,6 +28,7 @@ module.exports = { // 3. if a matching record is found locally, serve it if (result) { // return the data for the file to be served + result.dataValues['fileExt'] = result.fileName.substring(result.fileName.lastIndexOf('.')); serveHelpers.getShortUrlByClaimId(name, claimId) .then(shortUrl => { result.dataValues['shortUrl'] = shortUrl; @@ -64,6 +65,7 @@ module.exports = { if (result) { logger.debug('local result found'); // return the data for the file to be served + result.dataValues['fileExt'] = result.fileName.substring(result.fileName.lastIndexOf('.')); serveHelpers.getShortUrlByClaimId(name, claimId) .then(shortUrl => { result.dataValues['shortUrl'] = shortUrl; @@ -123,6 +125,7 @@ module.exports = { // 3. if a match is found locally, serve that claim if (result) { // return the data for the file to be served + result.dataValues['fileExt'] = result.fileName.substring(result.fileName.lastIndexOf('.')); result.dataValues['shortUrl'] = shortUrl; resolve(result.dataValues); // update the file, as needed diff --git a/routes/serve-routes.js b/routes/serve-routes.js index 8e0cfe5a..d1bcf2b0 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -141,7 +141,7 @@ module.exports = (app) => { } else if (dotIndex === -1) { // google analytics sendGoogleAnalytics('show', headers, ip, originalUrl); - // get and render the content + // begin image-show process showClaimByName(params.name) .then(fileInfo => { // check to make sure a file was found diff --git a/views/partials/assetInfo.handlebars b/views/partials/assetInfo.handlebars index a163c0ef..f0c54d8d 100644 --- a/views/partials/assetInfo.handlebars +++ b/views/partials/assetInfo.handlebars @@ -6,20 +6,20 @@

Links

{{!--short direct link to asset--}}
- Permanent Short Link + Permanent Short Link (most convenient)
- +
{{!-- link to show route for asset--}}
- Permanent Long Link + Permanent Long Link (fastest service)
- +
{{!-- html text for embedding asset--}} @@ -28,9 +28,9 @@
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}} - + {{else}} - + {{/ifConditional}} @@ -41,7 +41,7 @@ Markdown
- + {{/ifConditional}}