log more information about HTTP’s max upload size
This commit is contained in:
parent
6e0ec9b924
commit
0157039e87
|
@ -134,10 +134,12 @@ public class FileBackend {
|
||||||
|
|
||||||
public static boolean allFilesUnderSize(Context context, List<Uri> uris, long max) {
|
public static boolean allFilesUnderSize(Context context, List<Uri> uris, long max) {
|
||||||
if (max <= 0) {
|
if (max <= 0) {
|
||||||
|
Log.d(Config.LOGTAG,"server did not report max file size for http upload");
|
||||||
return true; //exception to be compatible with HTTP Upload < v0.2
|
return true; //exception to be compatible with HTTP Upload < v0.2
|
||||||
}
|
}
|
||||||
for(Uri uri : uris) {
|
for(Uri uri : uris) {
|
||||||
if (FileBackend.getFileSize(context, uri) > max) {
|
if (FileBackend.getFileSize(context, uri) > max) {
|
||||||
|
Log.d(Config.LOGTAG,"not all files are under "+max+" bytes. suggesting falling back to jingle");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1555,7 +1555,12 @@ public class XmppConnection implements Runnable {
|
||||||
if (items.size() > 0) {
|
if (items.size() > 0) {
|
||||||
try {
|
try {
|
||||||
long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Xmlns.HTTP_UPLOAD, "max-file-size"));
|
long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Xmlns.HTTP_UPLOAD, "max-file-size"));
|
||||||
return filesize <= maxsize;
|
if(filesize <= maxsize) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": http upload is not available for files with size "+filesize+" (max is "+maxsize+")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue