Skip to content

FINERACT-1878: Separate profile image paths for staff and clients#5496

Open
airajena wants to merge 1 commit intoapache:developfrom
airajena:FINERACT-1878/profile-image-sharing-between-client-and-staff
Open

FINERACT-1878: Separate profile image paths for staff and clients#5496
airajena wants to merge 1 commit intoapache:developfrom
airajena:FINERACT-1878/profile-image-sharing-between-client-and-staff

Conversation

@airajena
Copy link
Contributor

Description

Fixes profile image path collision between Client and Staff entities when they share the same numeric ID.

Previously, image save operations always used the images/clients/{id} path, even for Staff uploads. This caused Staff and Client images with the same ID to overwrite/read from the same location.

Changes

  • Updated ContentRepository image save method signatures to include entityName.
  • Updated image write flow in ImageWritePlatformServiceJpaRepositoryImpl to pass the entity type (clients or staff) to the content repository.
  • Updated FileSystemContentRepository image path generation to use:
    • images/clients/{id} for clients
    • images/staff/{id} for staff
  • Updated S3ContentRepository image path generation with the same entity-specific behavior.

Testing

  • Ran targeted compile checks:
    • ./gradlew :fineract-document:compileJava :fineract-provider:compileJava
  • Ran targeted static analysis:
    • ./gradlew :fineract-document:spotbugsMain :fineract-provider:spotbugsMain :fineract-document:spotbugsTest :fineract-provider:spotbugsTest
  • module-wide spotless/checkstyle currently reports pre-existing formatting/line-ending issues in unrelated files in this environment.

Related Issue

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a possibility to add a Test class?

@airajena
Copy link
Contributor Author

Is there a possibility to add a Test class?

Yes sure, will update and let u know

@airajena airajena force-pushed the FINERACT-1878/profile-image-sharing-between-client-and-staff branch from e80c964 to 610c7a3 Compare February 15, 2026 08:16
@IOhacker
Copy link
Contributor

@airajena also please run ./gradlew :fineract-document:spotlessApply

@airajena airajena force-pushed the FINERACT-1878/profile-image-sharing-between-client-and-staff branch from 610c7a3 to 6b6c65f Compare February 15, 2026 12:21
@airajena
Copy link
Contributor Author

@airajena also please run ./gradlew :fineract-document:spotlessApply

my bad, I have fixed it

@adamsaghy
Copy link
Contributor

`The following files had format violations:
src/test/java/org/apache/fineract/infrastructure/documentmanagement/service/ImageWritePlatformServiceJpaRepositoryImplTest.java
@@ -74,8 +74,8 @@
········when(staff.getId()).thenReturn(entityId);
········when(staff.getImage()).thenReturn(null);

      -········CommandProcessingResult·result·=·service.saveOrUpdateImage("staff",·entityId,·"profile.png",·new·ByteArrayInputStream(new·byte[]·{·1,
      -················2,·3·}),·3L);
      +········CommandProcessingResult·result·=·service.saveOrUpdateImage("staff",·entityId,·"profile.png",
      +················new·ByteArrayInputStream(new·byte[]·{·1,·2,·3·}),·3L);
       
       ········verify(contentRepository).saveImage(any(ByteArrayInputStream.class),·eq("staff"),·eq(entityId),·eq("profile.png"),·eq(3L));
       ········verify(staff).setImage(any(Image.class));

Run './gradlew :fineract-provider:spotlessApply' to fix these violations.
`

@airajena airajena force-pushed the FINERACT-1878/profile-image-sharing-between-client-and-staff branch from 6b6c65f to 7380cd4 Compare February 17, 2026 11:43
@adamsaghy
Copy link
Contributor

@airajena Please rebase your branch with latest develop branch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants