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)) {
|
||||
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;
|
||||
}
|
||||
@@ -620,9 +622,13 @@ public:
|
||||
std::string id = request_uri.query("id");
|
||||
fs::path path = GetTone3000ThumbnailFile(this->model->Tone3000ThumbnailDirectory(), id);
|
||||
if (!fs::exists(path))
|
||||
{
|
||||
path = GetTone3000ThumbnailFile(this->model->OldTone3000ThumbnailDirectory(),id);
|
||||
if (!fs::exists(path))
|
||||
{
|
||||
throw PiPedalException("File not found.");
|
||||
}
|
||||
}
|
||||
auto mimeType = GetMimeType(path);
|
||||
if (mimeType.empty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user