serve static assets on urls with file extension #538
2 changed files with 8 additions and 8 deletions
|
@ -19,10 +19,10 @@ var AssetPreview = function AssetPreview(_ref) {
|
||||||
fileExt = _ref$claimData.fileExt,
|
fileExt = _ref$claimData.fileExt,
|
||||||
contentType = _ref$claimData.contentType,
|
contentType = _ref$claimData.contentType,
|
||||||
thumbnail = _ref$claimData.thumbnail;
|
thumbnail = _ref$claimData.thumbnail;
|
||||||
var directSourceLink = "asset/".concat(name, "/").concat(claimId);
|
var embedUrl = "/".concat(claimId, "/").concat(name, ".").concat(fileExt);
|
||||||
var showUrlLink = "/".concat(claimId, "/").concat(name);
|
var showUrl = "/".concat(claimId, "/").concat(name);
|
||||||
return _react.default.createElement(_reactRouterDom.Link, {
|
return _react.default.createElement(_reactRouterDom.Link, {
|
||||||
to: showUrlLink
|
to: showUrl
|
||||||
}, function () {
|
}, function () {
|
||||||
switch (contentType) {
|
switch (contentType) {
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
|
@ -31,7 +31,7 @@ var AssetPreview = function AssetPreview(_ref) {
|
||||||
case 'image/gif':
|
case 'image/gif':
|
||||||
return _react.default.createElement("img", {
|
return _react.default.createElement("img", {
|
||||||
className: 'asset-preview-image',
|
className: 'asset-preview-image',
|
||||||
src: directSourceLink,
|
src: embedUrl,
|
||||||
alt: name
|
alt: name
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
|
const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
|
||||||
const directSourceLink = `asset/${name}/${claimId}`;
|
const embedUrl = `/${claimId}/${name}.${fileExt}`;
|
||||||
const showUrlLink = `/${claimId}/${name}`;
|
const showUrl = `/${claimId}/${name}`;
|
||||||
return (
|
return (
|
||||||
<Link to={showUrlLink} >
|
<Link to={showUrl} >
|
||||||
{(() => {
|
{(() => {
|
||||||
switch (contentType) {
|
switch (contentType) {
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
|
@ -15,7 +15,7 @@ const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, c
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
className={'asset-preview-image'}
|
className={'asset-preview-image'}
|
||||||
src={directSourceLink}
|
src={embedUrl}
|
||||||
alt={name}
|
alt={name}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue