mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
merge with branch issue-697
This commit is contained in:
@@ -73,18 +73,18 @@ public final class HttpUtil
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String ENCODING = "UTF-8";
|
public static final String ENCODING = "UTF-8";
|
||||||
|
|
||||||
/**
|
|
||||||
* location header
|
|
||||||
* @since 1.43
|
|
||||||
*/
|
|
||||||
public static final String HEADER_LOCATION = "Location";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* content-length header
|
* content-length header
|
||||||
* @since 1.46
|
* @since 1.46
|
||||||
*/
|
*/
|
||||||
public static final String HEADER_CONTENT_LENGTH = "Content-Length";
|
public static final String HEADER_CONTENT_LENGTH = "Content-Length";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* location header
|
||||||
|
* @since 1.43
|
||||||
|
*/
|
||||||
|
public static final String HEADER_LOCATION = "Location";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* header for identifying the scm-manager client
|
* header for identifying the scm-manager client
|
||||||
* @since 1.19
|
* @since 1.19
|
||||||
@@ -296,6 +296,25 @@ public final class HttpUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the value for the content-disposition attachment header. The method
|
||||||
|
* creates the filename as specified in rfc6266.
|
||||||
|
*
|
||||||
|
* @param name attachment name
|
||||||
|
* @see <a href="http://tools.ietf.org/html/rfc6266#section-5">rfc6266 section 5</a>
|
||||||
|
* @return value of content-disposition header
|
||||||
|
* @since 1.46
|
||||||
|
*/
|
||||||
|
public static String createContentDispositionAttachmentHeader(String name)
|
||||||
|
{
|
||||||
|
StringBuilder buffer = new StringBuilder("attachment; ");
|
||||||
|
|
||||||
|
buffer.append("filename=\"").append(name).append("\"; ");
|
||||||
|
buffer.append("filename*=utf-8''").append(encode(name));
|
||||||
|
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1141,7 +1141,7 @@ public class RepositoryResource
|
|||||||
*/
|
*/
|
||||||
private String getContentDispositionName(String name)
|
private String getContentDispositionName(String name)
|
||||||
{
|
{
|
||||||
return "attachment; filename=\"".concat(name).concat("\"");
|
return HttpUtil.createContentDispositionAttachmentHeader(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user