You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2018/02/02 13:08:05 UTC

[GitHub] cziegeler closed pull request #1: SLING-7466 - adding update of existing resource to make sure datauri ?

cziegeler closed pull request #1: SLING-7466 - adding update of existing resource to make sure datauri ?
URL: https://github.com/apache/sling-org-apache-sling-installer-core/pull/1
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java b/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
index c61af04..e143af6 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
@@ -373,7 +373,20 @@ public void addOrUpdate(final RegisteredResourceImpl r) {
                 if ( rr.getURL().equals(r.getURL()) ) {
                     if ( RegisteredResourceImpl.isSameResource((RegisteredResourceImpl)rr, r) ) {
                         if ( !rr.getDigest().equals(r.getDigest()) ) {
-                            // same resource but different digest, we need to remove the file
+                            // same resource but different digest, we need to to update the file
+                            LOGGER.debug("Updating resource with due to different digest: {}", r);
+                            try {
+								InternalResource intRes = InternalResource.create(r.getScheme(), 
+										new InstallableResource(r.getEntityId(), 
+												r.getInputStream(), 
+												r.getDictionary(),
+												r.getDigest(), 
+												r.getType(), 
+												r.getPriority()));
+								((RegisteredResourceImpl)rr).update(intRes);
+                            } catch (IOException e) {
+								LOGGER.error("Failed to update resource with different digest: {}", r);
+							}
                             LOGGER.debug("Cleanup duplicate resource: {}", r);
                             this.cleanup(r);
                         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services