fix: file path unavailable

When clicking play, the file does re-download now, so no need to do anything there. Improved click behavior when file is deleted - it now still opens the folder in case someone is interested.
This commit is contained in:
Thomas Zarebczan 2019-02-11 17:51:17 -05:00
parent 421bcaf388
commit ffb4bf46cc

View file

@ -64,9 +64,12 @@ class FileDetails extends PureComponent<Props> {
const mediaType = contentType || 'unknown'; const mediaType = contentType || 'unknown';
let downloadPath = let downloadPath =
fileInfo && fileInfo.download_path ? path.normalize(fileInfo.download_path) : null; fileInfo && fileInfo.download_path ? path.normalize(fileInfo.download_path) : null;
// We should check if the file exists, and then show a better message, wtih an option to redownload. let downloadNote;
if (fileInfo && fileInfo.download_path === null) // If the path is blank, file is not avialable. Create path from name so the folder opens on click.
downloadPath = 'File may have been deleted or moved.'; if (fileInfo && fileInfo.download_path === null) {
downloadPath = `${fileInfo.download_directory}/${fileInfo.file_name}`;
downloadNote = 'This file may have been moved or deleted';
}
return ( return (
<Fragment> <Fragment>
@ -103,7 +106,7 @@ class FileDetails extends PureComponent<Props> {
<Button <Button
button="link" button="link"
onClick={() => openFolder(downloadPath)} onClick={() => openFolder(downloadPath)}
label={downloadPath} label={downloadNote || downloadPath}
/> />
</div> </div>
)} )}