Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
add error msg to api/share.html and skip display of url on nothing uploaded
reger91ab8a526a1b
diff --git a/htroot/api/share.html b/htroot/api/share.htmlindex fb7124061..acbab1ca9 100644--- a/htroot/api/share.html+++ b/htroot/api/share.html@@ -31,7 +31,7 @@<tr><th>Item</th><th>URL</th><th>Success</th><th>Message</th></tr><tr><td>#[item]#</td>- <td><a href="#[url]#">#[url]#</a></td>+ <td>#(success)#::<a href="#[url]#">#[url]#</a>#(/success)#</td><td>#(success)#fail::ok#(/success)#</td><td>#(success)##[message]#::<a href="#[message]#" target="_blank">#[message]#</a>#(/success)#</td></tr>diff --git a/htroot/api/share.java b/htroot/api/share.javaindex a2deeb2ad..d9b327e22 100644--- a/htroot/api/share.java+++ b/htroot/api/share.java@@ -22,7 +22,6 @@ import java.io.File;import java.io.ByteArrayInputStream;import java.io.IOException;import java.nio.file.Files;-import java.nio.file.Path;import java.nio.file.StandardCopyOption;import net.yacy.yacy;@@ -30,7 +29,6 @@ import net.yacy.cora.document.encoding.UTF8;import net.yacy.cora.order.Base64Order;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.util.ConcurrentLog;-import net.yacy.search.Switchboard;import net.yacy.search.index.Fulltext;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;@@ -63,12 +61,19 @@ public class share {// push mode: this does a document uploadprop.put("mode", 1);- prop.put("success", 0);+ prop.put("mode_success", 0);if (post == null) return prop;// check file nameString filename = post.get("data", "");- if (!filename.startsWith(Fulltext.yacy_dump_prefix) || !filename.endsWith(".xml.gz")) return prop;+ if (filename.isEmpty()) {+ prop.put("mode_success_message", "file name is empty");+ return prop;+ }+ if (!filename.startsWith(Fulltext.yacy_dump_prefix) || !filename.endsWith(".xml.gz")) {+ prop.put("mode_success_message", "no index dump file (" + Fulltext.yacy_dump_prefix + "*.xml.gz)");+ return prop;+ }// check dataString dataString = post.get("data$file", "");@@ -99,7 +104,7 @@ public class share {return prop;}- prop.put("success", 1);+ prop.put("mode_success", 1);return prop;}