fix: filter based on MIME type instead of plaintext suffix
Suffixes are unreliable in different locales, while MIME types are more standarized.
This commit is contained in:
parent
f7f39854f8
commit
2fbb7be23b
@ -100,7 +100,8 @@ void SkinUploadDialog::on_buttonBox_accepted()
|
||||
|
||||
void SkinUploadDialog::on_skinBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_path = QFileDialog::getOpenFileName(this, tr("Select Skin Texture"), QString(), "*.png");
|
||||
auto filter = QMimeDatabase().mimeTypeForName("image/png").filterString();
|
||||
QString raw_path = QFileDialog::getOpenFileName(this, tr("Select Skin Texture"), QString(), filter);
|
||||
if (raw_path.isEmpty() || !QFileInfo::exists(raw_path))
|
||||
{
|
||||
return;
|
||||
|
@ -143,7 +143,8 @@ void ImportPage::setUrl(const QString& url)
|
||||
|
||||
void ImportPage::on_modpackBtn_clicked()
|
||||
{
|
||||
const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)"));
|
||||
auto filter = QMimeDatabase().mimeTypeForName("application/zip").filterString();
|
||||
const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), filter);
|
||||
if (url.isValid())
|
||||
{
|
||||
if (url.isLocalFile())
|
||||
|
Loading…
Reference in New Issue
Block a user