diff --git a/core/src/main/groovy/com/muwire/core/collections/FileCollectionBuilder.groovy b/core/src/main/groovy/com/muwire/core/collections/FileCollectionBuilder.groovy index 3e87144b..fbf569f5 100644 --- a/core/src/main/groovy/com/muwire/core/collections/FileCollectionBuilder.groovy +++ b/core/src/main/groovy/com/muwire/core/collections/FileCollectionBuilder.groovy @@ -88,7 +88,7 @@ class FileCollectionBuilder { comment = "" else comment = DataUtil.readi18nString(Base64.decode(comment)) - def item = new FileCollectionItem(new InfoHash(sf.root), comment, sfPathElements.get(sf), (byte)sf.pieceSize, sf.getCachedLength()) + def item = new FileCollectionItem(new InfoHash(sf.root), comment, sfPathElements.get(sf), (byte)sf.pieceSize, sf.getFile().length()) files.add(item) } diff --git a/core/src/main/groovy/com/muwire/core/filefeeds/FeedItems.groovy b/core/src/main/groovy/com/muwire/core/filefeeds/FeedItems.groovy index 41b16959..0dd35aed 100644 --- a/core/src/main/groovy/com/muwire/core/filefeeds/FeedItems.groovy +++ b/core/src/main/groovy/com/muwire/core/filefeeds/FeedItems.groovy @@ -16,7 +16,7 @@ class FeedItems { json.version = 1 json.name = Base64.encode(DataUtil.encodei18nString(sf.getFile().getName())) json.infoHash = Base64.encode(sf.getRoot()) - json.size = sf.getCachedLength() + json.size = sf.getFile().length() json.pieceSize = sf.getPieceSize() if (sf.getComment() != null) diff --git a/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy b/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy index 56fe9002..4904fff1 100644 --- a/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy +++ b/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy @@ -144,7 +144,7 @@ abstract class BasePersisterService extends Service{ protected static toJson(SharedFile sf) { def json = [:] json.file = Base64.encode(DataUtil.encodei18nString(sf.file.toString())) - json.length = sf.getCachedLength() + json.length = sf.getFile().length() json.root = Base64.encode(sf.getRoot()) json.pieceSize = sf.getPieceSize() json.comment = sf.getComment() diff --git a/core/src/main/groovy/com/muwire/core/mulinks/FileMuLink.groovy b/core/src/main/groovy/com/muwire/core/mulinks/FileMuLink.groovy index ee55ba76..1f0f124d 100644 --- a/core/src/main/groovy/com/muwire/core/mulinks/FileMuLink.groovy +++ b/core/src/main/groovy/com/muwire/core/mulinks/FileMuLink.groovy @@ -39,7 +39,7 @@ class FileMuLink extends MuLink { super(me, sharedFile.getRootInfoHash(), sharedFile.getFile().getName(), deriveSig(sharedFile, spk), LinkType.FILE) - fileSize = sharedFile.getCachedLength() + fileSize = sharedFile.getFile().length() pieceSizePow2 = sharedFile.getPieceSize() } @@ -50,7 +50,7 @@ class FileMuLink extends MuLink { daos.write(sharedFile.getRoot()) daos.write(sharedFile.getFile().getName().getBytes(StandardCharsets.UTF_8)) daos.writeByte(LinkType.FILE.ordinal()) - daos.writeLong(sharedFile.getCachedLength()) + daos.writeLong(sharedFile.getFile().length()) daos.writeByte(sharedFile.getPieceSize()) daos.flush() diff --git a/core/src/main/groovy/com/muwire/core/search/ResultsSender.groovy b/core/src/main/groovy/com/muwire/core/search/ResultsSender.groovy index cc2bb61b..a13ef6d7 100644 --- a/core/src/main/groovy/com/muwire/core/search/ResultsSender.groovy +++ b/core/src/main/groovy/com/muwire/core/search/ResultsSender.groovy @@ -215,7 +215,7 @@ class ResultsSender { obj.version = 2 obj.name = encodedName obj.infohash = Base64.encode(sf.getRoot()) - obj.size = sf.getCachedLength() + obj.size = sf.getFile().length() obj.pieceSize = sf.getPieceSize() if (sf instanceof DownloadedFile)