Fixed image download when name contains ":"

This commit is contained in:
North 2012-11-05 20:31:19 +02:00
parent cc306b2119
commit e049f39cb1
2 changed files with 5 additions and 2 deletions

View file

@ -456,7 +456,10 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
@Override @Override
public void run() { public void run() {
try { try {
File temporaryFile = new File(Constants.IO.imageBaseDir + File.separator + card.hashCode() + "." + card.getName() + ".jpg"); StringBuilder filePath = new StringBuilder();
filePath.append(Constants.IO.imageBaseDir).append(File.separator);
filePath.append(card.hashCode()).append(".").append(card.getName().replace(":", "")).append(".jpg");
File temporaryFile = new File(filePath.toString());
String imagePath = CardImageUtils.getImagePath(card, imagesPath); String imagePath = CardImageUtils.getImagePath(card, imagesPath);
TFile outputFile = new TFile(imagePath); TFile outputFile = new TFile(imagePath);
if (!outputFile.exists()) { if (!outputFile.exists()) {

View file

@ -133,7 +133,7 @@ public class CardImageUtils {
String imageName; String imageName;
String type = card.getType() != 0 ? " " + Integer.toString(card.getType()) : ""; String type = card.getType() != 0 ? " " + Integer.toString(card.getType()) : "";
String name = card.getName(); String name = card.getName().replace(":", "");
if (basicLandPattern.matcher(name).matches()) { if (basicLandPattern.matcher(name).matches()) {
imageName = name + "." + card.getCollectorId() + ".full.jpg"; imageName = name + "." + card.getCollectorId() + ".full.jpg";