- if (entry.getName().equals(getDataPrefix() + "version")) {
- // Nothing to do for now ("first"
- // version is 3.0)
- } else if (entryLName.endsWith(".info")) {
- // Info file
- IOUtils.write(zipIn, tmpInfo);
- } else if (imageEntry) {
- // Cover
- if (getCover()) {
- try {
- cover = IOUtils.toImage(zipIn);
- } catch (Exception e) {
- Instance.syserr(e);
+ if (entryLName.equals("version")) {
+ // Nothing to do for now ("first"
+ // version is 3.0)
+ } else if (entryLName.endsWith(".info")) {
+ // Info file
+ IOUtils.write(zipIn, tmpInfo);
+ } else if (imageEntry) {
+ // Cover
+ if (getCover() && cover == null) {
+ try {
+ Image img = new Image(zipIn);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ cover = img;
+ } catch (Exception e) {
+ Instance.getInstance().getTraceHandler()
+ .error(e);
+ }
+ }
+ } else if (entryLName.equals("url")) {
+ String[] descArray = StringUtils
+ .unhtml(IOUtils.readSmallStream(zipIn)).trim()
+ .split("\n");
+ if (descArray.length > 0) {
+ url = descArray[0].trim();
+ }
+ } else if (entryLName.endsWith(".desc")) {
+ // // For old files
+ // if (this.desc != null) {
+ // this.desc = IOUtils.readSmallStream(zipIn).trim();
+ // }
+ } else if (entryLName.equals("summary")) {
+ String[] descArray = StringUtils
+ .unhtml(IOUtils.readSmallStream(zipIn)).trim()
+ .split("\n");
+ int skip = 0;
+ if (descArray.length > 1) {
+ title = descArray[0].trim();
+ skip = 1;
+ if (descArray.length > 2
+ && descArray[1].startsWith("©")) {
+ author = descArray[1].substring(1).trim();
+ skip = 2;
+ }