Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 29238 attaching files feature on tasks. UI fix #30158

Merged
merged 11 commits into from
Oct 1, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ boolean isDownloadPermissionBasedRestricted(final Contentlet contentlet, final U
public String getFileLink(final HttpServletRequest request, final User user, final Contentlet contentlet, final String field) throws DotDataException, DotSecurityException {

ResourceLink link = this.build(request, user, contentlet, field);
final Host host = getHost(contentlet.getHost(), user);
Host host = getHost((String)request.getAttribute(HOST_REQUEST_ATTRIBUTE) , user);
if(null == host){
host = getHost(contentlet.getHost(), user);
}

final StringBuilder hostUrlBuilder = new StringBuilder(request.isSecure()? HTTPS_PREFIX:HTTP_PREFIX);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ private FileAsset transformDotAsset(Contentlet con) {

final HttpServletRequest request = HttpServletRequestThreadLocal.INSTANCE.getRequest();
if (request != null) {
final String fileLink = new ResourceLink.ResourceLinkBuilder().getFileLink(request, APILocator.systemUser(), fileAsset, "fileAsset");
final String fileLink = new ResourceLink.ResourceLinkBuilder().build(request, APILocator.systemUser(), fileAsset, FileAssetAPI.BINARY_FIELD).getConfiguredImageURL();


fileAsset.getMap().put("fileLink", fileLink);
}
Expand Down Expand Up @@ -479,7 +480,7 @@ private String getRelativeAssetPath(String inode, String fileName) {
String path = "";

path = java.io.File.separator + _inode.charAt(0)
+ java.io.File.separator + _inode.charAt(1) + java.io.File.separator + _inode + java.io.File.separator + "fileAsset" + java.io.File.separator+ fileName;
+ java.io.File.separator + _inode.charAt(1) + java.io.File.separator + _inode + java.io.File.separator + FileAssetAPI.BINARY_FIELD + java.io.File.separator+ fileName;

return path;

Expand Down Expand Up @@ -620,7 +621,7 @@ public String getRealAssetPath(final String inode, final String fileName, final
final String fullFileName = UtilMethods.isSet(ext) ? fileName + "." + ext : fileName;
final String path = ((!UtilMethods.isSet(realPath)) ? assetPath : realPath)
+ inode.charAt(0) + java.io.File.separator + inode.charAt(1)
+ java.io.File.separator + inode+ java.io.File.separator + "fileAsset" + java.io.File.separator + fullFileName;
+ java.io.File.separator + inode+ java.io.File.separator + FileAssetAPI.BINARY_FIELD + java.io.File.separator + fullFileName;

if (!UtilMethods.isSet(realPath)) {
return FileUtil.getRealPath(path);
Expand Down Expand Up @@ -680,7 +681,7 @@ public String getRealAssetPath(String inode) {

path = ((!UtilMethods.isSet(realPath)) ? assetPath : realPath)
+ _inode.charAt(0) + java.io.File.separator + _inode.charAt(1)
+ java.io.File.separator + _inode+ java.io.File.separator + "fileAsset" + java.io.File.separator;
+ java.io.File.separator + _inode+ java.io.File.separator + FileAssetAPI.BINARY_FIELD + java.io.File.separator;

if (!UtilMethods.isSet(realPath))
return FileUtil.getRealPath(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,14 @@ public String getGravatar(String postedBy){
}
%>
<tr <%=str_style %>>
<a href="<%= (fileAsset != null && fileAsset.getMap().get("fileLink") != null) ? fileAsset.getMap().get("fileLink") : file.getURI() %>" target="_blank">
<%= (fileAsset != null && fileAsset.getMap().get("fileLink") != null) ? fileAsset.getUnderlyingFileName() : file.getFileName() %>
</a>

<td>
<a href="<%= (fileAsset != null && fileAsset.getMap().get("fileLink") != null) ? fileAsset.getMap().get("fileLink") : file.getURI() %>" target="_blank">
<%= (fileAsset != null && fileAsset.getMap().get("fileLink") != null) ? fileAsset.getUnderlyingFileName() : file.getFileName() %>
</a>
</td>
<td>

<button dojoType="dijit.form.Button" type="button" class="dijitButtonDanger" style="float: right;" onClick="removeFile('<%= file.getInode() %>')"><%= LanguageUtil.get(pageContext, "remove") %></button>
</td>
</tr>
Expand Down