Skip to content

Commit

Permalink
fix: default %ext% to the model value if file_url does not have any (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Apr 30, 2024
1 parent c6b22e2 commit 7038185
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/src/models/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ Image::Image(Site *site, QMap<QString, QString> details, QVariantMap identity, Q
const QString realExt = details["ext"];
if (ext != realExt) {
setFileExtension(realExt);
m_extension = realExt;
}
} else if (ext == QLatin1String("jpg") && !url(Size::Thumbnail).isEmpty()) {
bool fixed = false;
Expand Down Expand Up @@ -899,7 +900,13 @@ Page *Image::page() const { return m_parent; }
const QUrl &Image::parentUrl() const { return m_parentUrl; }
bool Image::isGallery() const { return m_isGallery; }
ExtensionRotator *Image::extensionRotator() const { return m_extensionRotator; }
QString Image::extension() const { return getExtension(m_url).toLower(); }
QString Image::extension() const {
QString urlExt = getExtension(m_url).toLower();
if (!urlExt.isEmpty()) {
return urlExt;
}
return m_extension;
}

void Image::setPromoteDetailParsWarn(bool val) { m_detailsParsWarnAsErr = val; }
void Image::setPreviewImage(const QPixmap &preview)
Expand Down
1 change: 1 addition & 0 deletions src/lib/src/models/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class Image : public QObject, public Downloadable
Profile *m_profile;
Page *m_parent = nullptr;
QUrl m_url;
QString m_extension;
QUrl m_pageUrl;
QUrl m_parentUrl;
QSettings *m_settings;
Expand Down

0 comments on commit 7038185

Please sign in to comment.