Store original extension.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 28 Jul 2012 22:50:48 +0000 (00:50 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 28 Jul 2012 22:50:48 +0000 (00:50 +0200)
src/main/java/net/pterodactylus/demoscenemusic/page/admin/AddTrackDerivativePage.java

index 2a80f78..91ab832 100644 (file)
@@ -119,6 +119,9 @@ public class AddTrackDerivativePage extends AdminBasePage {
                                        /* okay, we’re here, so everything’s fine, probably. */
                                        TrackDerivative derivative = getCore().getDataManager().createTrackDerivative(track);
                                        derivative.getProperties().set("file/original-name", filename);
+                                       if (filename.indexOf('.') > filename.lastIndexOf('/')) {
+                                               derivative.getProperties().set("file/extension", filename.substring(filename.lastIndexOf('.') + 1));
+                                       }
                                        getCore().getDataManager().saveTrackDerivate(derivative);
 
                                        /* copy the file again. */