diff --git a/webdav/pom.xml b/webdav/pom.xml index 2ac556dc2f6..9add8eba604 100644 --- a/webdav/pom.xml +++ b/webdav/pom.xml @@ -24,7 +24,7 @@ jar - 5.14 + 5.14.1 4.0.5.2400 diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVAttributesFinderFeature.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVAttributesFinderFeature.java index 7d6c264e129..2e262886d8f 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVAttributesFinderFeature.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVAttributesFinderFeature.java @@ -214,6 +214,11 @@ else if(resource.getModified() != null) { attributes.setDisplayname(resource.getDisplayName()); } attributes.setLockId(resource.getLockToken()); + switch(resource.getStatusCode()) { + // 425 Too Early for partial tus uploads + case 425: + attributes.setHidden(true); + } return attributes; } } diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVClient.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVClient.java index 227e1c06aec..2f8327eddd4 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVClient.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVClient.java @@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; +import org.apache.http.ParseException; import org.apache.http.auth.AuthScope; import org.apache.http.auth.Credentials; import org.apache.http.client.CredentialsProvider; @@ -35,6 +36,7 @@ import org.apache.http.impl.client.BasicAuthCache; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.message.BasicLineParser; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -52,6 +54,7 @@ import com.github.sardine.impl.methods.HttpPropFind; import com.github.sardine.model.Multistatus; import com.github.sardine.model.Propfind; +import com.github.sardine.model.Propstat; import com.github.sardine.model.Response; import com.github.sardine.util.SardineUtil; @@ -122,7 +125,27 @@ public List propfind(final String url, final int depth, final Propf List resources = new ArrayList<>(responses.size()); for(Response response : responses) { try { - resources.add(new DavResource(response)); + resources.add(new DavResource(response) { + @Override + public int getStatusCode() { + List list = response.getPropstat(); + if(list.isEmpty()) { + return DEFAULT_STATUS_CODE; + } + for(Propstat propstat : list) { + if(propstat.getStatus() != null) { + try { + return BasicLineParser.parseStatusLine(propstat.getStatus(), null).getStatusCode(); + } + catch(ParseException e) { + log.warn("Failed to parse status line: {}", propstat.getStatus()); + return -1; + } + } + } + return super.getStatusCode(); + } + }); } catch(URISyntaxException e) { log.warn("Ignore resource with invalid URI {}", response.getHref().get(0)); diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVListService.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVListService.java index ca4818e1598..87a24c2e123 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVListService.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVListService.java @@ -73,8 +73,13 @@ public AttributedList list(final Path directory, final ListProgressListene throw new NotfoundException(directory.getAbsolute()); } final PathAttributes attr = attributes.toAttributes(resource); - final Path file = new Path(directory, PathNormalizer.name(resource.getHref().getPath()), - resource.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file), attr); + final EnumSet type = resource.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file); + switch(resource.getStatusCode()) { + // 425 Too Early for partial tus uploads + case 425: + type.add(Path.Type.upload); + } + final Path file = new Path(directory, PathNormalizer.name(resource.getHref().getPath()), type, attr); children.add(file); listener.chunk(directory, children); } diff --git a/webdav/src/main/java/ch/cyberduck/core/dav/DAVQuotaFeature.java b/webdav/src/main/java/ch/cyberduck/core/dav/DAVQuotaFeature.java index ad16222414f..fa5739ae46e 100644 --- a/webdav/src/main/java/ch/cyberduck/core/dav/DAVQuotaFeature.java +++ b/webdav/src/main/java/ch/cyberduck/core/dav/DAVQuotaFeature.java @@ -40,6 +40,9 @@ public Space get() throws BackgroundException { final Path home = new DefaultHomeFinderService(session).find(); try { final DavQuota quota = session.getClient().getQuota(new DAVPathEncoder().encode(home)); + if(null == quota) { + return Quota.unknown; + } return new Space( quota.getQuotaUsedBytes() > 0 ? quota.getQuotaUsedBytes() : 0, quota.getQuotaAvailableBytes() >= 0 ? quota.getQuotaAvailableBytes() : Long.MAX_VALUE