Skip to content

Commit 0d33b47

Browse files
author
jefffischer
committed
Merge pull request BroadleafCommerce#1432 from BroadleafCommerce/qa-649-asset-versioning
qa 649 asset versioning
2 parents 40dc195 + d09eb57 commit 0d33b47

File tree

3 files changed

+10
-60
lines changed

3 files changed

+10
-60
lines changed

admin/broadleaf-contentmanagement-module/src/main/java/org/broadleafcommerce/cms/file/service/StaticAssetServiceImpl.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ protected String buildAssetURL(Map<String, String> assetProperties, String origi
161161
fileName = originalFilename;
162162
}
163163

164+
String[] splitBits = fileName.replace(".", "/").split("/");
165+
String imageName = splitBits[splitBits.length - 2];
166+
String imageTypeExt = splitBits[splitBits.length - 1];
167+
fileName = imageName + '-' + 1 + '.' + imageTypeExt;
168+
164169
return path.append(fileName).toString();
165170
}
166171

@@ -186,7 +191,11 @@ public StaticAsset createStaticAsset(InputStream inputStream, String fileName, l
186191
int count = 0;
187192
while (newAsset != null) {
188193
count++;
189-
194+
//removing the default count 1, from fullUrl for count logic
195+
if (fullUrl.contains("-1")) {
196+
fullUrl = fullUrl.replace("-1", "");
197+
count++;
198+
}
190199
//try the new format first, then the old
191200
newAsset = staticAssetDao.readStaticAssetByFullUrl(getCountUrl(fullUrl, count, false));
192201
if (newAsset == null) {

admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/service/persistence/StaticAssetPersistenceEventHandler.java

-58
This file was deleted.

admin/broadleaf-open-admin-platform/src/main/resources/bl-open-admin-contentCreator-applicationContext.xml

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
<property name="sourceList">
4141
<list>
4242
<ref bean="blArchiveStatusPersistenceEventHandler" />
43-
<ref bean="blStaticAssetPersistenceEventHandler" />
4443
</list>
4544
</property>
4645
</bean>

0 commit comments

Comments
 (0)