diff --git a/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java b/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java index 08b6c16941f578e7170998fe82387f40039a90f9..2eda795875746737af798b6122dc72ae833a0af4 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java +++ b/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java @@ -145,6 +145,29 @@ public class MetaInfo this.info_hash = calculateInfoHash(); } + public MetaInfo(MetaInfo old, String new_announce, List<List<String>> new_announce_list, String new_comment, String new_created_by) + { + this.announce = new_announce; + this.info_hash = old.info_hash; + this.name = old.name; + this.name_utf8 = old.name_utf8; + this.files = old.files; + this.files_utf8 = old.files_utf8; + this.attributes = old.attributes; + this.lengths = old.lengths; + this.piece_length = old.piece_length; + this.piece_hashes = old.piece_hashes; + this.length = old.length; + this.privateTorrent = old.privateTorrent; + this.announce_list = new_announce_list; + this.comment = new_comment; + this.created_by = new_created_by; + this.creation_date = old.creation_date; + this.url_list = old.url_list; + this.infoMap = old.infoMap; + this.infoBytesLength = old.infoBytesLength; + } + /** * Creates a new MetaInfo from the given InputStream. The * InputStream must start with a correctly bencoded dictionary diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 0f72510660bb1f3aa27e336caedc7f3f71444adb..f8fc6e253cd4ea1e2d1f4aa430dda88dde279ffa 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -4886,14 +4886,7 @@ public class I2PSnarkServlet extends BasicServlet { newComment = null; if (newCreatedBy.equals("")) newCreatedBy = null; - MetaInfo newMeta = new MetaInfo(thePrimary, meta.getName(), null, meta.getFiles(), meta.getLengths(), - meta.getPieceLength(0), meta.getPieceHashes(), meta.getTotalLength(), meta.getPrivateTrackerStatus(), - newAnnList, newCreatedBy, meta.getWebSeedURLs(), newComment); - if (!DataHelper.eq(meta.getInfoHash(), newMeta.getInfoHash())) { - // shouldn't happen - _manager.addMessage("Torrent edit failed, infohash mismatch"); - return; - } + MetaInfo newMeta = new MetaInfo(meta, thePrimary, newAnnList, newComment, newCreatedBy); File f = new File(_manager.util().getTempDir(), "edit-" + _manager.util().getContext().random().nextLong() + ".torrent"); OutputStream out = null; try {