87 lines
2.9 KiB
Java
87 lines
2.9 KiB
Java
|
package o;
|
||
|
|
||
|
import java.io.File;
|
||
|
import okhttp3.MediaType;
|
||
|
import okhttp3.MultipartBody;
|
||
|
import okhttp3.RequestBody;
|
||
|
import org.jmrtd.lds.ImageInfo;
|
||
|
|
||
|
/* renamed from: o.gy, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public final class C15600gy {
|
||
|
private C15600gy() {
|
||
|
}
|
||
|
|
||
|
public static final MultipartBody.Part a(String str, String str2) {
|
||
|
String str3;
|
||
|
MediaType parse;
|
||
|
C14957gcv.e(str, "");
|
||
|
C14957gcv.e(str2, "");
|
||
|
File file = new File(str2);
|
||
|
RequestBody.Companion companion = RequestBody.Companion;
|
||
|
String str4 = str2;
|
||
|
C14957gcv.e(str4, "");
|
||
|
int b = gdZ.b((CharSequence) str4, '.', str4.length() - 1) + 1;
|
||
|
if (b < str2.length()) {
|
||
|
str3 = str2.substring(b);
|
||
|
C14957gcv.c((Object) str3, "");
|
||
|
} else {
|
||
|
str3 = "";
|
||
|
}
|
||
|
int hashCode = str3.hashCode();
|
||
|
if (hashCode == 105441) {
|
||
|
if (str3.equals("jpg")) {
|
||
|
parse = MediaType.Companion.parse(ImageInfo.JPEG_MIME_TYPE);
|
||
|
}
|
||
|
parse = MediaType.Companion.parse("application/pdf");
|
||
|
} else if (hashCode == 111145) {
|
||
|
if (str3.equals("png")) {
|
||
|
parse = MediaType.Companion.parse("image/png");
|
||
|
}
|
||
|
parse = MediaType.Companion.parse("application/pdf");
|
||
|
} else {
|
||
|
if (hashCode == 114833 && str3.equals("tif")) {
|
||
|
parse = MediaType.Companion.parse("image/tiff");
|
||
|
}
|
||
|
parse = MediaType.Companion.parse("application/pdf");
|
||
|
}
|
||
|
RequestBody create = companion.create(file, parse);
|
||
|
MultipartBody.Part.Companion companion2 = MultipartBody.Part.Companion;
|
||
|
String name = file.getName();
|
||
|
C14957gcv.e(file, "");
|
||
|
String name2 = file.getName();
|
||
|
C14957gcv.c((Object) name2, "");
|
||
|
String c = gdZ.c(name2, "");
|
||
|
if (!gdZ.d((CharSequence) c)) {
|
||
|
c = ".".concat(String.valueOf(c));
|
||
|
C14957gcv.c((Object) name, "");
|
||
|
name = gdZ.b(name, c, name);
|
||
|
}
|
||
|
int length = name.length();
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
char charAt = name.charAt(i);
|
||
|
if ((C14957gcv.a(charAt, 31) <= 0 && charAt != '\t') || C14957gcv.a(charAt, 127) >= 0) {
|
||
|
name = "temp";
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(name);
|
||
|
sb.append(c);
|
||
|
return companion2.createFormData(str, sb.toString(), create);
|
||
|
}
|
||
|
|
||
|
public static final RequestBody e(String str) {
|
||
|
C14957gcv.e(str, "");
|
||
|
File file = new File(str);
|
||
|
RequestBody.Companion companion = RequestBody.Companion;
|
||
|
String name = file.getName();
|
||
|
C14957gcv.c((Object) name, "");
|
||
|
return companion.create(name, MediaType.Companion.parse("text/plain"));
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
new C15600gy();
|
||
|
}
|
||
|
}
|