Don't update url unless we have a reason to (Cheogram)

This commit is contained in:
Arne 2023-05-23 12:48:11 +02:00
parent 12fe325683
commit 766dd86b7f
2 changed files with 6 additions and 4 deletions

View file

@ -1210,9 +1210,11 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put("cid", cid.toString());
cv.put("path", file.getAbsolutePath());
cv.put("url", url);
db.insertWithOnConflict("monocles.cids", null, cv, SQLiteDatabase.CONFLICT_REPLACE);
if (file != null) cv.put("path", file.getAbsolutePath());
if (url != null) cv.put("url", url);
if (db.update("monocles.cids", cv, "cid=?", new String[]{cid.toString()}) < 1) {
db.insertWithOnConflict("monocles.cids", null, cv, SQLiteDatabase.CONFLICT_REPLACE);
}
}
public static class FilePath {

View file

@ -1789,7 +1789,7 @@ public class FileBackend {
if (updateCids) {
try {
for (int i = 0; i < cids.length; i++) {
mXmppConnectionService.saveCid(cids[i], file, url);
mXmppConnectionService.saveCid(cids[i], file);
}
} catch (XmppConnectionService.BlockedMediaException e) { }
}