ensure that App description is never null
In the v0 index format, empty descriptions were filled in with boilerplate text. The v1 index format instead leaves empty descriptions empty, and lets the various consumers (fdroidclient, web interfaces, etc) decide what to show. The database and code still assume that the description will not be null, so instead this ensures there is something in the database, but it will be an empty string instead of a null. In the future, it would probably make sense to standardize empty values on null or something.
This commit is contained in:
parent
611fd6e5e3
commit
bc0db92c50
@ -12,9 +12,9 @@ import android.util.Log;
|
|||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.Schema.ApkTable;
|
import org.fdroid.fdroid.data.Schema.ApkTable;
|
||||||
import org.fdroid.fdroid.data.Schema.AppPrefsTable;
|
|
||||||
import org.fdroid.fdroid.data.Schema.AppMetadataTable;
|
import org.fdroid.fdroid.data.Schema.AppMetadataTable;
|
||||||
import org.fdroid.fdroid.data.Schema.AppMetadataTable.Cols;
|
import org.fdroid.fdroid.data.Schema.AppMetadataTable.Cols;
|
||||||
|
import org.fdroid.fdroid.data.Schema.AppPrefsTable;
|
||||||
import org.fdroid.fdroid.data.Schema.CatJoinTable;
|
import org.fdroid.fdroid.data.Schema.CatJoinTable;
|
||||||
import org.fdroid.fdroid.data.Schema.CategoryTable;
|
import org.fdroid.fdroid.data.Schema.CategoryTable;
|
||||||
import org.fdroid.fdroid.data.Schema.InstalledAppTable;
|
import org.fdroid.fdroid.data.Schema.InstalledAppTable;
|
||||||
@ -837,6 +837,11 @@ public class AppProvider extends FDroidProvider {
|
|||||||
values.remove(Cols.Package.PACKAGE_NAME);
|
values.remove(Cols.Package.PACKAGE_NAME);
|
||||||
values.put(Cols.PACKAGE_ID, packageId);
|
values.put(Cols.PACKAGE_ID, packageId);
|
||||||
|
|
||||||
|
if (!values.containsKey(Cols.DESCRIPTION) || values.getAsString(Cols.DESCRIPTION) == null) {
|
||||||
|
// the current structure assumes that description is always present and non-null
|
||||||
|
values.put(Cols.DESCRIPTION, "");
|
||||||
|
}
|
||||||
|
|
||||||
String[] categories = null;
|
String[] categories = null;
|
||||||
boolean saveCategories = false;
|
boolean saveCategories = false;
|
||||||
if (values.containsKey(Cols.ForWriting.Categories.CATEGORIES)) {
|
if (values.containsKey(Cols.ForWriting.Categories.CATEGORIES)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user