mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
Dav: make sure Destination contains full url and not only path, may fix SMTP send and IMAP copyMessage on Exchange 2003
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1562 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
47e90d9bec
commit
28dbdc41b2
@ -1736,7 +1736,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
@Override
|
@Override
|
||||||
public void moveItem(String sourcePath, String targetPath) throws IOException {
|
public void moveItem(String sourcePath, String targetPath) throws IOException {
|
||||||
MoveMethod method = new MoveMethod(URIUtil.encodePath(getFolderPath(sourcePath)),
|
MoveMethod method = new MoveMethod(URIUtil.encodePath(getFolderPath(sourcePath)),
|
||||||
URIUtil.encodePath(getFolderPath(targetPath)), false);
|
getEscapedUrlFromPath(URIUtil.encodePath(getFolderPath(targetPath))), false);
|
||||||
try {
|
try {
|
||||||
int statusCode = httpClient.executeMethod(method);
|
int statusCode = httpClient.executeMethod(method);
|
||||||
if (statusCode == HttpStatus.SC_PRECONDITION_FAILED) {
|
if (statusCode == HttpStatus.SC_PRECONDITION_FAILED) {
|
||||||
@ -2525,13 +2525,17 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getEscapedUrlFromPath(String escapdePath) throws URIException {
|
||||||
|
URI uri = new URI(httpClient.getHostConfiguration().getHostURL(), true);
|
||||||
|
uri.setEscapedPath(escapdePath);
|
||||||
|
return uri.getEscapedURI();
|
||||||
|
}
|
||||||
|
|
||||||
protected InputStream getContentInputStream(String url, boolean fixHostName) throws IOException {
|
protected InputStream getContentInputStream(String url, boolean fixHostName) throws IOException {
|
||||||
String actualUrl = URIUtil.encodePath(url);
|
String actualUrl = URIUtil.encodePath(url);
|
||||||
if (fixHostName) {
|
if (fixHostName) {
|
||||||
String targetPath = new URI(actualUrl, true).getEscapedPath();
|
String targetPath = new URI(actualUrl, true).getEscapedPath();
|
||||||
URI targetUri = new URI(httpClient.getHostConfiguration().getHostURL(), true);
|
actualUrl = getEscapedUrlFromPath(targetPath);
|
||||||
targetUri.setEscapedPath(targetPath);
|
|
||||||
actualUrl = targetUri.getEscapedURI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final GetMethod method = new GetMethod(actualUrl);
|
final GetMethod method = new GetMethod(actualUrl);
|
||||||
@ -2582,7 +2586,8 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
|
|
||||||
protected void copyMessage(String sourceUrl, String targetFolder) throws IOException {
|
protected void copyMessage(String sourceUrl, String targetFolder) throws IOException {
|
||||||
String targetPath = URIUtil.encodePath(getFolderPath(targetFolder)) + '/' + UUID.randomUUID().toString();
|
String targetPath = URIUtil.encodePath(getFolderPath(targetFolder)) + '/' + UUID.randomUUID().toString();
|
||||||
CopyMethod method = new CopyMethod(URIUtil.encodePath(sourceUrl), targetPath, false);
|
String targetUri = getEscapedUrlFromPath(targetPath);
|
||||||
|
CopyMethod method = new CopyMethod(URIUtil.encodePath(sourceUrl), targetUri, false);
|
||||||
// allow rename if a message with the same name exists
|
// allow rename if a message with the same name exists
|
||||||
method.addRequestHeader("Allow-Rename", "t");
|
method.addRequestHeader("Allow-Rename", "t");
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user