Fix crash with custom artist images
This commit is contained in:
parent
48f83f030a
commit
7fdadd3310
1 changed files with 2 additions and 9 deletions
|
|
@ -22,8 +22,6 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
|
|
@ -124,13 +122,8 @@ public class CustomArtistImageUtil {
|
|||
}
|
||||
|
||||
private static String getFileName(Artist artist) {
|
||||
try {
|
||||
return String.format(Locale.US, "#%d#%s.jpeg", artist.getId(), URLEncoder.encode(artist.getName(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
// UTF-8 should be always valid
|
||||
return null;
|
||||
}
|
||||
// replace everything that is not a letter or a number with _
|
||||
return String.format(Locale.US, "#%d#%s.jpeg", artist.getId(), artist.getName().replaceAll("[^a-zA-Z0-9]", "_"));
|
||||
}
|
||||
|
||||
public static File getFile(Artist artist) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue