made checks for valid image extensions case insensitive
This commit is contained in:
parent
3522243835
commit
2723c9ccb9
|
@ -395,7 +395,7 @@ public class Message extends AbstractEntity {
|
||||||
String[] pathParts = url.getPath().split("/");
|
String[] pathParts = url.getPath().split("/");
|
||||||
String filename;
|
String filename;
|
||||||
if (pathParts.length > 0) {
|
if (pathParts.length > 0) {
|
||||||
filename = pathParts[pathParts.length - 1];
|
filename = pathParts[pathParts.length - 1].toLowerCase();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class HttpConnection implements Downloadable {
|
||||||
this.message.setDownloadable(this);
|
this.message.setDownloadable(this);
|
||||||
try {
|
try {
|
||||||
mUrl = new URL(message.getBody());
|
mUrl = new URL(message.getBody());
|
||||||
String path = mUrl.getPath();
|
String path = mUrl.getPath().toLowerCase();
|
||||||
if (path != null && (path.endsWith(".pgp") || path.endsWith(".gpg"))) {
|
if (path != null && (path.endsWith(".pgp") || path.endsWith(".gpg"))) {
|
||||||
this.message.setEncryption(Message.ENCRYPTION_PGP);
|
this.message.setEncryption(Message.ENCRYPTION_PGP);
|
||||||
} else if (message.getEncryption() != Message.ENCRYPTION_OTR) {
|
} else if (message.getEncryption() != Message.ENCRYPTION_OTR) {
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class JingleConnection implements Downloadable {
|
||||||
Element fileNameElement = fileOffer.findChild("name");
|
Element fileNameElement = fileOffer.findChild("name");
|
||||||
if (fileNameElement != null) {
|
if (fileNameElement != null) {
|
||||||
String[] filename = fileNameElement.getContent()
|
String[] filename = fileNameElement.getContent()
|
||||||
.toLowerCase(Locale.US).split("\\.");
|
.toLowerCase(Locale.US).toLowerCase().split("\\.");
|
||||||
if (Arrays.asList(VALID_IMAGE_EXTENSIONS).contains(
|
if (Arrays.asList(VALID_IMAGE_EXTENSIONS).contains(
|
||||||
filename[filename.length - 1])) {
|
filename[filename.length - 1])) {
|
||||||
message.setType(Message.TYPE_IMAGE);
|
message.setType(Message.TYPE_IMAGE);
|
||||||
|
|
Loading…
Reference in a new issue