#2 Folder sharing fixup
This commit is contained in:
@@ -83,6 +83,7 @@ public class FilesController implements InitializingBean {
|
||||
model.addAttribute("sortOrder", order);
|
||||
model.addAttribute("apps", this.appRegistry.getAll());
|
||||
model.addAttribute("restricted", this.sessionInfo.isRestrictedSession());
|
||||
model.addAttribute("prefix", "");
|
||||
this.webContainerSharedConfig.addDefaults(model);
|
||||
|
||||
return "files/filesIndex";
|
||||
@@ -121,6 +122,7 @@ public class FilesController implements InitializingBean {
|
||||
model.addAttribute("apps", this.appRegistry.getAll());
|
||||
model.addAttribute("filename", filename);
|
||||
model.addAttribute("restricted", this.sessionInfo.isRestrictedSession());
|
||||
model.addAttribute("prefix", "");
|
||||
this.webContainerSharedConfig.addDefaults(model);
|
||||
|
||||
return "files/rename";
|
||||
@@ -148,6 +150,11 @@ public class FilesController implements InitializingBean {
|
||||
return "redirect:/files/browse/" + this.locationTracker.getRelativeLocation();
|
||||
}
|
||||
|
||||
@GetMapping("/files/shares/files/download")
|
||||
public ResponseEntity sharesDownloadFile(HttpServletResponse response, String filename) {
|
||||
return downloadFile(response, filename);
|
||||
}
|
||||
|
||||
@GetMapping("/files/download")
|
||||
public ResponseEntity downloadFile(HttpServletResponse response, String filename) {
|
||||
final Path targetPath = this.locationTracker.resolve(filename);
|
||||
@@ -226,6 +233,7 @@ public class FilesController implements InitializingBean {
|
||||
model.addAttribute("apps", this.appRegistry.getAll());
|
||||
model.addAttribute("filename", filename);
|
||||
model.addAttribute("restricted", this.sessionInfo.isRestrictedSession());
|
||||
model.addAttribute("prefix", "");
|
||||
this.webContainerSharedConfig.addDefaults(model);
|
||||
|
||||
return "files/share";
|
||||
@@ -271,6 +279,17 @@ public class FilesController implements InitializingBean {
|
||||
return "redirect:/files/browse/" + this.locationTracker.getRelativeLocation();
|
||||
}
|
||||
|
||||
@GetMapping("/files/shares/files/browse/**")
|
||||
public String sharesStart(Model model, HttpServletRequest httpServletRequest, String sortOrder) {
|
||||
final String start = start(model, httpServletRequest, sortOrder);
|
||||
|
||||
model.addAttribute("prefix", "/files/shares");
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
// We need to copy all functions for shares because they should be available without auth and that is
|
||||
// controlled by the URI via htaccess/htpasswd
|
||||
@GetMapping("files/shares")
|
||||
public Object shares(Model model, String shareUuid) {
|
||||
this.locationTracker.reset();
|
||||
@@ -299,8 +318,9 @@ public class FilesController implements InitializingBean {
|
||||
|
||||
if(this.fileSystemService.isDirectory(sharedFilePath)) {
|
||||
this.locationTracker.setBaseDirPath(share.getPath());
|
||||
this.locationTracker.resetCurrentLocation();
|
||||
|
||||
return "redirect:/files/browse";
|
||||
return "redirect:/files/browse/";
|
||||
}
|
||||
else {
|
||||
return doShares(shareUuid);
|
||||
@@ -332,8 +352,9 @@ public class FilesController implements InitializingBean {
|
||||
|
||||
if(this.fileSystemService.isDirectory(sharedFilePath)) {
|
||||
this.locationTracker.setBaseDirPath(share.getPath());
|
||||
this.locationTracker.resetCurrentLocation();
|
||||
|
||||
return "redirect:/files/browse";
|
||||
return "redirect:/files/browse/";
|
||||
}
|
||||
else {
|
||||
return doShares(shareUuid);
|
||||
@@ -385,6 +406,11 @@ public class FilesController implements InitializingBean {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/files/shares/files/preview")
|
||||
public void sharesPreview(HttpServletResponse response, String filename) {
|
||||
preview(response, filename);
|
||||
}
|
||||
|
||||
@GetMapping("files/preview")
|
||||
public void preview(HttpServletResponse response, String filename) {
|
||||
try {
|
||||
@@ -398,6 +424,15 @@ public class FilesController implements InitializingBean {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/files/shares/files/gallery")
|
||||
public String sharesGallery(Model model) {
|
||||
final String gallery = gallery(model);
|
||||
|
||||
model.addAttribute("prefix", "/files/shares");
|
||||
|
||||
return gallery;
|
||||
}
|
||||
|
||||
@GetMapping("files/gallery")
|
||||
public String gallery(Model model) {
|
||||
try {
|
||||
@@ -406,6 +441,7 @@ public class FilesController implements InitializingBean {
|
||||
model.addAttribute("files", files);
|
||||
model.addAttribute("apps", this.appRegistry.getAll());
|
||||
model.addAttribute("restricted", this.sessionInfo.isRestrictedSession());
|
||||
model.addAttribute("prefix", "");
|
||||
this.webContainerSharedConfig.addDefaults(model);
|
||||
|
||||
return "files/gallery";
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
<td th:if="${fileEntry.directory}" class="no-mobile">d</td>
|
||||
<td th:if="${!fileEntry.directory}" class="no-mobile">-</td>
|
||||
<td th:if="${fileEntry.directory}">
|
||||
<a th:if="${fileEntry.name != '..'}" th:href="@{/files/browse/__${fileEntry.path}__}"
|
||||
<a th:if="${fileEntry.name != '..'}" th:href="@{__${prefix}__/files/browse/__${fileEntry.path}__}"
|
||||
th:text="${fileEntry.name}"/>
|
||||
<a th:if="${fileEntry.name == '..'}" th:href="@{/files/browse/__${fileEntry.path}__}"
|
||||
<a th:if="${fileEntry.name == '..'}" th:href="@{__${prefix}__/files/browse/__${fileEntry.path}__}"
|
||||
th:text="${fileEntry.name}"/>
|
||||
</td>
|
||||
<td th:if="${!fileEntry.directory && @filesFormatter.needsTruncate(fileEntry.name)}"
|
||||
@@ -78,12 +78,12 @@
|
||||
th:text="#{nbscloud.files-content-table.table.actions.delete}"/>
|
||||
</div>
|
||||
<div id="files-content-table-show-actions-detail-container-download">
|
||||
<a th:href="@{/files/download(filename=${fileEntry.name})}"
|
||||
<a th:href="@{__${prefix}__/files/download(filename=${fileEntry.name})}"
|
||||
th:text="#{nbscloud.files-content-table.table.actions.download}"/>
|
||||
</div>
|
||||
<div th:if="${!fileEntry.directory}"
|
||||
id="files-content-table-show-actions-detail-container-preview">
|
||||
<a th:href="@{/files/preview(filename=${fileEntry.name})}"
|
||||
<a th:href="@{__${prefix}__/files/preview(filename=${fileEntry.name})}"
|
||||
th:text="#{nbscloud.files-content-table.table.actions.preview}"/>
|
||||
</div>
|
||||
<div id="files-content-table-show-actions-detail-container-share"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div id="main-container">
|
||||
<div th:replace="includes/header :: header"/>
|
||||
<div id="gallery-container">
|
||||
<img class="galleryImage" th:each="file : ${files}" th:src="@{/files/preview(filename=${file})}">
|
||||
<img class="galleryImage" th:each="file : ${files}" th:src="@{__${prefix}__/files/preview(filename=${file})}">
|
||||
</div>
|
||||
<div th:replace="includes/footer :: footer"/>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
<div class="menu-spacer"></div>
|
||||
<div>
|
||||
<a id="gallery-link" th:href="@{/files/gallery}">
|
||||
<a id="gallery-link" th:href="@{__${prefix}__/files/gallery}">
|
||||
<span class="icon menu-icon"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user