Don't return 404 for GET requests on collections
This commit is contained in:
parent
2ce9fceaff
commit
ca056dea9f
@ -258,9 +258,7 @@ class Application:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
status = client.UNAUTHORIZED
|
status = client.UNAUTHORIZED
|
||||||
realm = self.configuration.get("server", "realm")
|
realm = self.configuration.get("server", "realm")
|
||||||
headers = {
|
headers = {"WWW-Authenticate": "Basic realm=\"%s\"" % realm}
|
||||||
"WWW-Authenticate":
|
|
||||||
"Basic realm=\"%s\"" % realm}
|
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"Refused /.well-known/ redirection to anonymous user")
|
"Refused /.well-known/ redirection to anonymous user")
|
||||||
else:
|
else:
|
||||||
@ -379,23 +377,22 @@ class Application:
|
|||||||
# Get collection item
|
# Get collection item
|
||||||
item = collection.get(item_name)
|
item = collection.get(item_name)
|
||||||
if item:
|
if item:
|
||||||
answer_text = item.serialize()
|
answer = item.serialize()
|
||||||
etag = item.etag
|
etag = item.etag
|
||||||
else:
|
else:
|
||||||
return client.NOT_FOUND, {}, None
|
return client.NOT_FOUND, {}, None
|
||||||
else:
|
else:
|
||||||
# Get whole collection
|
# Get whole collection
|
||||||
answer_text = collection.serialize()
|
answer = collection.serialize()
|
||||||
if not answer_text:
|
|
||||||
self.logger.debug("Collection at %s unknown" % environ["PATH_INFO"])
|
|
||||||
return client.NOT_FOUND, {}, None
|
|
||||||
etag = collection.etag
|
etag = collection.etag
|
||||||
|
|
||||||
|
if answer:
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": storage.MIMETYPES[collection.get_meta("tag")],
|
"Content-Type": storage.MIMETYPES[collection.get_meta("tag")],
|
||||||
"Last-Modified": collection.last_modified,
|
"Last-Modified": collection.last_modified,
|
||||||
"ETag": etag}
|
"ETag": etag}
|
||||||
answer = answer_text
|
else:
|
||||||
|
headers = {}
|
||||||
return client.OK, headers, answer
|
return client.OK, headers, answer
|
||||||
|
|
||||||
def do_HEAD(self, environ, read_collections, write_collections, content,
|
def do_HEAD(self, environ, read_collections, write_collections, content,
|
||||||
|
Loading…
Reference in New Issue
Block a user