|
|
@ -26,8 +26,8 @@ import androidx.work.WorkerParameters; |
|
|
|
|
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.google.gson.JsonSyntaxException; |
|
|
|
import com.icafe4j.image.meta.Metadata; |
|
|
|
import com.icafe4j.image.meta.MetadataType; |
|
|
|
|
|
|
|
import org.apache.commons.imaging.formats.jpeg.iptc.JpegIptcRewriter; |
|
|
|
|
|
|
|
import java.io.BufferedInputStream; |
|
|
|
import java.io.File; |
|
|
@ -89,6 +89,7 @@ public class DownloadWorker extends Worker { |
|
|
|
try (Scanner scanner = new Scanner(requestFile)) { |
|
|
|
downloadRequestString = scanner.useDelimiter("\\A").next(); |
|
|
|
} catch (Exception e) { |
|
|
|
Log.e(TAG, "doWork: ", e); |
|
|
|
return Result.failure(new Data.Builder() |
|
|
|
.putString("error", e.getLocalizedMessage()) |
|
|
|
.build()); |
|
|
@ -170,9 +171,10 @@ public class DownloadWorker extends Worker { |
|
|
|
} |
|
|
|
if (isJpg) { |
|
|
|
final File finalFile = new File(filePath); |
|
|
|
try (FileInputStream bis = new FileInputStream(outFile); |
|
|
|
try (FileInputStream fis = new FileInputStream(outFile); |
|
|
|
FileOutputStream fos = new FileOutputStream(finalFile)) { |
|
|
|
Metadata.removeMetadata(bis, fos, MetadataType.IPTC); |
|
|
|
final JpegIptcRewriter jpegIptcRewriter = new JpegIptcRewriter(); |
|
|
|
jpegIptcRewriter.removeIPTC(fis, fos); |
|
|
|
} catch (Exception e) { |
|
|
|
Log.e(TAG, "Error while removing iptc: url: " + url |
|
|
|
+ ", tempFile: " + outFile.getAbsolutePath() |
|
|
|