Skip to content

Commit

Permalink
fixup! gcoap/fileserver: implement PUT/POST/DELETE functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Jun 15, 2022
1 parent 669684d commit cf39dcf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sys/net/application_layer/gcoap/fileserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,17 @@ static ssize_t _put_directory(coap_pkt_t *pdu, uint8_t *buf, size_t len,
(void)resource;
int err;
vfs_DIR dir;
if (request->options.exists.if_match && request->options.if_match_len) {
return gcoap_fileserver_error_handler(pdu, buf, len, COAP_CODE_PRECONDITION_FAILED);
}
if ((err = vfs_opendir(&dir, request->namebuf)) == 0) {
vfs_closedir(&dir);
if (request->options.exists.if_match && request->options.if_match_len) {
return gcoap_fileserver_error_handler(pdu, buf, len, COAP_CODE_PRECONDITION_FAILED);
}
gcoap_resp_init(pdu, buf, len, COAP_CODE_CHANGED);
}
else {
if (request->options.exists.if_match) {
return gcoap_fileserver_error_handler(pdu, buf, len, COAP_CODE_PRECONDITION_FAILED);
}
if ((err = vfs_mkdir(request->namebuf, 0)) < 0) {
return gcoap_fileserver_error_handler(pdu, buf, len, err);
}
Expand Down

0 comments on commit cf39dcf

Please sign in to comment.