mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
do not upload files > 20Mb
This commit is contained in:
parent
ad8ce3a0e5
commit
cfe5420c19
1 changed files with 5 additions and 2 deletions
|
@ -286,7 +286,10 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyncStatus uploadBookToServerInternal(Book book) {
|
private SyncStatus uploadBookToServerInternal(Book book) {
|
||||||
final ZLPhysicalFile file = book.File.getPhysicalFile();
|
final File file = book.File.getPhysicalFile().javaFile();
|
||||||
|
if (file.length() > 20 * 1024 * 1024) {
|
||||||
|
return SyncStatus.Failure;
|
||||||
|
}
|
||||||
final String hash = myCollection.getHash(book);
|
final String hash = myCollection.getHash(book);
|
||||||
final boolean force = book.labels().contains(Book.SYNC_TOSYNC_LABEL);
|
final boolean force = book.labels().contains(Book.SYNC_TOSYNC_LABEL);
|
||||||
if (hash == null) {
|
if (hash == null) {
|
||||||
|
@ -320,7 +323,7 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
||||||
final String status = (String)result.get("status");
|
final String status = (String)result.get("status");
|
||||||
if ((force && !"found".equals(status)) || "not found".equals(status)) {
|
if ((force && !"found".equals(status)) || "not found".equals(status)) {
|
||||||
try {
|
try {
|
||||||
final UploadRequest uploadRequest = new UploadRequest(file.javaFile());
|
final UploadRequest uploadRequest = new UploadRequest(file);
|
||||||
uploadRequest.addHeader("Referer", verificationRequest.getURL());
|
uploadRequest.addHeader("Referer", verificationRequest.getURL());
|
||||||
uploadRequest.addHeader("X-CSRFToken", csrfToken);
|
uploadRequest.addHeader("X-CSRFToken", csrfToken);
|
||||||
myNetworkContext.perform(uploadRequest);
|
myNetworkContext.perform(uploadRequest);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue