Merge lp:~mzanetti/reminders-app/fix-filename-extension into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 362
Merged at revision: 365
Proposed branch: lp:~mzanetti/reminders-app/fix-filename-extension
Merge into: lp:reminders-app
Prerequisite: lp:~mzanetti/reminders-app/save-note-after-editing-tags
Diff against target: 36 lines (+8/-4)
2 files modified
src/libqtevernote/note.cpp (+3/-2)
src/libqtevernote/utils/enmldocument.cpp (+5/-2)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/fix-filename-extension
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+251339@code.launchpad.net

Commit message

fix the filename extension for images

use the filename extension from the file, not the mimetype

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
362. By Michael Zanetti

don't crash if the image is not loaded yet

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/libqtevernote/note.cpp'
2--- src/libqtevernote/note.cpp 2015-02-28 00:45:30 +0000
3+++ src/libqtevernote/note.cpp 2015-02-28 00:45:30 +0000
4@@ -683,12 +683,13 @@
5
6 void Note::loadFromCacheFile() const
7 {
8- qDebug() << "Loading from cacheFile:" << m_guid;
9 if (m_cacheFile.exists() && m_cacheFile.open(QFile::ReadOnly)) {
10 m_content.setEnml(QString::fromUtf8(m_cacheFile.readAll()).trimmed());
11 m_tagline = m_content.toPlaintext().left(100);
12 m_cacheFile.close();
13- qDebug() << "cache file opened" << m_tagline;
14+ qDebug() << "[Storage] Loaded note from storage:" << m_guid;
15+ } else {
16+ qDebug() << "[Storage] Failed attempt to load note from storage:" << m_guid;
17 }
18 m_loaded = true;
19 }
20
21=== modified file 'src/libqtevernote/utils/enmldocument.cpp'
22--- src/libqtevernote/utils/enmldocument.cpp 2015-02-24 22:21:04 +0000
23+++ src/libqtevernote/utils/enmldocument.cpp 2015-02-28 00:45:30 +0000
24@@ -159,8 +159,11 @@
25 if (type == TypeRichText) {
26 writer.writeAttribute("src", composeMediaTypeUrl(mediaType, noteGuid, hash));
27 } else if (type == TypeHtml) {
28- QString imagePath = NotesStore::instance()->storageLocation() + hash + "." + mediaType.split('/').last();
29- writer.writeAttribute("src", imagePath);
30+ if (NotesStore::instance()->note(noteGuid)->resource(hash)) {
31+ QString fileName = NotesStore::instance()->note(noteGuid)->resource(hash)->fileName();
32+ QString imagePath = NotesStore::instance()->storageLocation() + hash + "." + fileName.split('.').last();
33+ writer.writeAttribute("src", imagePath);
34+ }
35 writer.writeAttribute("id", "en-attachment/" + hash + "/" + mediaType);
36 }
37

Subscribers

People subscribed via source and target branches