I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 727d76d4 authored by jrandom's avatar jrandom Committed by zzz
Browse files

deal with posts containing no tags by using the implicit tag "[none]" (thanks ardvark!)

parent 44770b7c
No related branches found
No related tags found
No related merge requests found
...@@ -115,12 +115,19 @@ public class EntryContainer { ...@@ -115,12 +115,19 @@ public class EntryContainer {
if (len <= 0) if (len <= 0)
break; break;
int split = line.indexOf(':'); int split = line.indexOf(':');
if ( (split <= 0) || (split >= len - 2) ) if (split <= 0) {
throw new IOException("Invalid format of the syndie entry: line=" + line); throw new IOException("Invalid format of the syndie entry: line=" + line);
String key = line.substring(0, split); } else if (split >= len - 2) {
String val = line.substring(split+1); // foo:\n
_rawKeys.add(key); String key = line.substring(0, split);
_rawValues.add(val); _rawKeys.add(key);
_rawValues.add("");
} else {
String key = line.substring(0, split);
String val = line.substring(split+1);
_rawKeys.add(key);
_rawValues.add(val);
}
} }
parseHeaders(); parseHeaders();
...@@ -275,7 +282,8 @@ public class EntryContainer { ...@@ -275,7 +282,8 @@ public class EntryContainer {
} }
public BlogURI getURI() { return _entryURI; } public BlogURI getURI() { return _entryURI; }
private static final String NO_TAGS[] = new String[0]; public static final String NO_TAGS_TAG = "[none]";
private static final String NO_TAGS[] = new String[] { NO_TAGS_TAG };
public String[] getTags() { public String[] getTags() {
String tags = getHeader(HEADER_BLOGTAGS); String tags = getHeader(HEADER_BLOGTAGS);
if ( (tags == null) || (tags.trim().length() <= 0) ) { if ( (tags == null) || (tags.trim().length() <= 0) ) {
......
...@@ -21,7 +21,7 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) { ...@@ -21,7 +21,7 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) {
int metaId = 0; int metaId = 0;
while (true) { while (true) {
InputStream meta = req.getInputStream("blogmeta" + metaId); InputStream meta = req.getInputStream("blogmeta" + metaId);
if (meta == null) if ( (meta == null) || (meta.available() <= 0) )
break; break;
if (!BlogManager.instance().importBlogMetadata(meta)) { if (!BlogManager.instance().importBlogMetadata(meta)) {
%><span class="b_importMsgErr">Metadata <%=metaId%> failed to be imported</span><br /><% %><span class="b_importMsgErr">Metadata <%=metaId%> failed to be imported</span><br /><%
...@@ -32,7 +32,7 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) { ...@@ -32,7 +32,7 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) {
int entryId = 0; int entryId = 0;
while (true) { while (true) {
InputStream entry = req.getInputStream("blogpost" + entryId); InputStream entry = req.getInputStream("blogpost" + entryId);
if (entry == null) if ( (entry == null) || (entry.available() <= 0) )
break; break;
if (!BlogManager.instance().importBlogEntry(entry)) { if (!BlogManager.instance().importBlogEntry(entry)) {
%><span class="b_importMsgErr">Entry <%=entryId%> failed to be imported</span><br /><% %><span class="b_importMsgErr">Entry <%=entryId%> failed to be imported</span><br /><%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment