Handle both old and new T3k thumbnail urs.
This commit is contained in:
@@ -97,7 +97,9 @@ static bool IsSafeThumbnailPath(const fs::path path)
|
|||||||
if (!HtmlHelper::IsSafeFileName(path)) {
|
if (!HtmlHelper::IsSafeFileName(path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(path.string().starts_with("/var/pipedal/tone3000_thumbnails/")))
|
if ((!path.string().starts_with("/var/pipedal/tone3000_thumbnails/")) &&
|
||||||
|
(!path.string().starts_with("/var/pipedal/audio_uploads/tone3000_thumbnails/"))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -620,9 +622,13 @@ public:
|
|||||||
std::string id = request_uri.query("id");
|
std::string id = request_uri.query("id");
|
||||||
fs::path path = GetTone3000ThumbnailFile(this->model->Tone3000ThumbnailDirectory(), id);
|
fs::path path = GetTone3000ThumbnailFile(this->model->Tone3000ThumbnailDirectory(), id);
|
||||||
if (!fs::exists(path))
|
if (!fs::exists(path))
|
||||||
|
{
|
||||||
|
path = GetTone3000ThumbnailFile(this->model->OldTone3000ThumbnailDirectory(),id);
|
||||||
|
if (!fs::exists(path))
|
||||||
{
|
{
|
||||||
throw PiPedalException("File not found.");
|
throw PiPedalException("File not found.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
auto mimeType = GetMimeType(path);
|
auto mimeType = GetMimeType(path);
|
||||||
if (mimeType.empty())
|
if (mimeType.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user