Skip to content

Commit 01c75f9

Browse files
authored
Application proxy changes for private blob storage (#67)
1 parent caf2a84 commit 01c75f9

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

asset-manager/web/src/main/java/com/microsoft/migration/assets/service/AwsS3Service.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,8 @@ private String extractFilename(String key) {
146146
}
147147

148148
private String generateUrl(String key) {
149-
GetUrlRequest request = GetUrlRequest.builder()
150-
.bucket(bucketName)
151-
.key(key)
152-
.build();
153-
return s3Client.utilities().getUrl(request).toString();
149+
// Use application proxy URL for consistent behavior across storage types
150+
return "/s3/view/" + key;
154151
}
155152

156153
private String generateKey(String filename) {

asset-manager/web/src/main/resources/templates/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h2>Your Images</h2>
77
<div class="row mt-4" id="imageContainer" th:if="${not #lists.isEmpty(objects)}">
88
<div class="col-md-4 mb-4" th:each="object : ${objects}" th:attr="data-key=${object.key}">
99
<div class="card">
10-
<img th:src="${object.url}" class="card-img-top" alt="Image preview" style="height: 200px; object-fit: cover;">
10+
<img th:src="@{'/s3/view/' + ${object.key}}" class="card-img-top" alt="Image preview" style="height: 200px; object-fit: cover;">
1111
<div class="card-body">
1212
<h5 class="card-title text-truncate" th:text="${object.name}">Image name</h5>
1313
<p class="card-text">

asset-manager/web/src/main/resources/templates/view.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div class="card-header d-flex justify-content-between align-items-center">
1919
<h3 class="card-title mb-0" th:text="${object.name}">Image Name</h3>
2020
<div>
21-
<a th:href="${object.url}" download class="btn btn-outline-primary btn-sm me-2">
21+
<a th:href="@{'/s3/view/' + ${object.key}}" download class="btn btn-outline-primary btn-sm me-2">
2222
<i class="bi bi-download"></i> Download
2323
</a>
2424
<form th:action="@{'/s3/delete/' + ${object.key}}" method="post" class="d-inline"
@@ -30,7 +30,7 @@ <h3 class="card-title mb-0" th:text="${object.name}">Image Name</h3>
3030
</div>
3131
</div>
3232
<div class="card-body text-center">
33-
<img th:src="${object.url}" class="img-fluid" alt="Image preview" style="max-height: 70vh;">
33+
<img th:src="@{'/s3/view/' + ${object.key}}" class="img-fluid" alt="Image preview" style="max-height: 70vh;">
3434
</div>
3535
<div class="card-footer">
3636
<div class="row">

0 commit comments

Comments
 (0)