* Fix Seafile setting page loading Check access_token instead of QSetting parameters to make sure that we're logged in. * Use CaseInsensitive file type checking (#5499) CloudFileService and TagReader classes use QString::endWith() method for checking file type. This method is CaseSensitive by default.
This commit is contained in:
parent
7ce7fe185e
commit
1a477201ed
|
@ -1104,19 +1104,21 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
|
|||
download_url, title, size, authorisation_header, network_));
|
||||
stream->Precache();
|
||||
std::unique_ptr<TagLib::File> tag;
|
||||
if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) {
|
||||
if (mime_type == "audio/mpeg" &&
|
||||
title.endsWith(".mp3", Qt::CaseInsensitive)) {
|
||||
tag.reset(new TagLib::MPEG::File(stream.get(),
|
||||
TagLib::ID3v2::FrameFactory::instance(),
|
||||
TagLib::AudioProperties::Accurate));
|
||||
} else if (mime_type == "audio/mp4" ||
|
||||
(mime_type == "audio/mpeg" && title.endsWith(".m4a"))) {
|
||||
(mime_type == "audio/mpeg" &&
|
||||
title.endsWith(".m4a", Qt::CaseInsensitive))) {
|
||||
tag.reset(new TagLib::MP4::File(stream.get(), true,
|
||||
TagLib::AudioProperties::Accurate));
|
||||
}
|
||||
#ifdef TAGLIB_HAS_OPUS
|
||||
else if ((mime_type == "application/opus" || mime_type == "audio/opus" ||
|
||||
mime_type == "application/ogg" || mime_type == "audio/ogg") &&
|
||||
title.endsWith(".opus")) {
|
||||
title.endsWith(".opus", Qt::CaseInsensitive)) {
|
||||
tag.reset(new TagLib::Ogg::Opus::File(stream.get(), true,
|
||||
TagLib::AudioProperties::Accurate));
|
||||
}
|
||||
|
|
|
@ -219,15 +219,17 @@ bool CloudFileService::IsSupportedMimeType(const QString& mime_type) const {
|
|||
}
|
||||
|
||||
QString CloudFileService::GuessMimeTypeForFile(const QString& filename) const {
|
||||
if (filename.endsWith(".mp3")) {
|
||||
if (filename.endsWith(".mp3", Qt::CaseInsensitive)) {
|
||||
return "audio/mpeg";
|
||||
} else if (filename.endsWith(".m4a") || filename.endsWith(".m4b")) {
|
||||
} else if (filename.endsWith(".m4a", Qt::CaseInsensitive) ||
|
||||
filename.endsWith(".m4b", Qt::CaseInsensitive)) {
|
||||
return "audio/mpeg";
|
||||
} else if (filename.endsWith(".ogg") || filename.endsWith(".opus")) {
|
||||
} else if (filename.endsWith(".ogg", Qt::CaseInsensitive) ||
|
||||
filename.endsWith(".opus", Qt::CaseInsensitive)) {
|
||||
return "application/ogg";
|
||||
} else if (filename.endsWith(".flac")) {
|
||||
} else if (filename.endsWith(".flac", Qt::CaseInsensitive)) {
|
||||
return "application/x-flac";
|
||||
} else if (filename.endsWith(".wma")) {
|
||||
} else if (filename.endsWith(".wma", Qt::CaseInsensitive)) {
|
||||
return "audio/x-ms-wma";
|
||||
}
|
||||
return QString::null;
|
||||
|
|
|
@ -63,7 +63,7 @@ void SeafileSettingsPage::Load() {
|
|||
ui_->server->setText(s.value("server").toString());
|
||||
ui_->mail->setText(s.value("mail").toString());
|
||||
|
||||
if (!ui_->server->text().isEmpty() && !ui_->mail->text().isEmpty()) {
|
||||
if (service_->has_credentials()) {
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn,
|
||||
ui_->mail->text());
|
||||
|
||||
|
|
Loading…
Reference in New Issue