mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 10:39:00 +08:00
Fix WebDav not using Global FS but Flash cannot compile
This commit is contained in:
parent
b56148c895
commit
3f5daa5381
@ -22,7 +22,7 @@
|
|||||||
#define _VERSION_ESP3D_H
|
#define _VERSION_ESP3D_H
|
||||||
|
|
||||||
// version and sources location
|
// version and sources location
|
||||||
#define FW_VERSION "3.0.0.a230"
|
#define FW_VERSION "3.0.0.a231"
|
||||||
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
|
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
|
||||||
|
|
||||||
#endif //_VERSION_ESP3D_H
|
#endif //_VERSION_ESP3D_H
|
||||||
|
@ -86,9 +86,20 @@ void WebdavServer::handler_copy(const char* url) {
|
|||||||
overwrite = true;
|
overwrite = true;
|
||||||
}
|
}
|
||||||
// check available space
|
// check available space
|
||||||
|
#if WEBDAV_FEATURE == FS_ROOT
|
||||||
|
uint64_t free_space = WebDavFS::freeBytes(fsTypeDestination);
|
||||||
|
#else
|
||||||
|
#if WEBDAV_FEATURE == FS_FLASH
|
||||||
|
size_t free_space;
|
||||||
|
#endif
|
||||||
|
#if WEBDAV_FEATURE == FS_SD
|
||||||
|
uint64_t free_space;
|
||||||
|
#endif
|
||||||
|
free_space = WebDavFS::freeBytes();
|
||||||
|
#endif
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
if (WebDavFS::exists(destination.c_str())) {
|
if (WebDavFS::exists(destination.c_str())) {
|
||||||
if (WebDavFS::freeBytes(fsTypeOrigin) + fileOrigin.size() <
|
if (free_space + fileOrigin.size() <
|
||||||
fileDestination.size()) {
|
fileDestination.size()) {
|
||||||
code = 507;
|
code = 507;
|
||||||
esp3d_log_e("Not enough space");
|
esp3d_log_e("Not enough space");
|
||||||
@ -97,7 +108,7 @@ void WebdavServer::handler_copy(const char* url) {
|
|||||||
code = 204;
|
code = 204;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (WebDavFS::freeBytes(fsTypeOrigin) < fileOrigin.size()) {
|
if (free_space < fileOrigin.size()) {
|
||||||
code = 507;
|
code = 507;
|
||||||
esp3d_log_e("Not enough space");
|
esp3d_log_e("Not enough space");
|
||||||
overwrite = false;
|
overwrite = false;
|
||||||
|
@ -58,7 +58,18 @@ void WebdavServer::handler_put(const char* url) {
|
|||||||
file.close();
|
file.close();
|
||||||
if (!hasError) {
|
if (!hasError) {
|
||||||
// check size available
|
// check size available
|
||||||
if (WebDavFS::freeBytes(fsType) + file.size() < content_length) {
|
#if WEBDAV_FEATURE == FS_ROOT
|
||||||
|
uint64_t free_space = WebDavFS::freeBytes(fsType);
|
||||||
|
#else
|
||||||
|
#if WEBDAV_FEATURE == FS_FLASH
|
||||||
|
size_t free_space;
|
||||||
|
#endif
|
||||||
|
#if WEBDAV_FEATURE == FS_SD
|
||||||
|
uint64_t free_space;
|
||||||
|
#endif
|
||||||
|
free_space = WebDavFS::freeBytes();
|
||||||
|
#endif
|
||||||
|
if (free_space + file.size() < content_length) {
|
||||||
code = 507;
|
code = 507;
|
||||||
esp3d_log_e("Not enough space");
|
esp3d_log_e("Not enough space");
|
||||||
hasError = true;
|
hasError = true;
|
||||||
@ -78,7 +89,18 @@ void WebdavServer::handler_put(const char* url) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// check size available
|
// check size available
|
||||||
if (WebDavFS::freeBytes(fsType) < content_length) {
|
#if WEBDAV_FEATURE == FS_ROOT
|
||||||
|
uint64_t free_space = WebDavFS::freeBytes(fsType);
|
||||||
|
#else
|
||||||
|
#if WEBDAV_FEATURE == FS_FLASH
|
||||||
|
size_t free_space;
|
||||||
|
#endif
|
||||||
|
#if WEBDAV_FEATURE == FS_SD
|
||||||
|
uint64_t free_space;
|
||||||
|
#endif
|
||||||
|
free_space = WebDavFS::freeBytes();
|
||||||
|
#endif
|
||||||
|
if (free_space < content_length) {
|
||||||
code = 507;
|
code = 507;
|
||||||
esp3d_log_e("Not enough space");
|
esp3d_log_e("Not enough space");
|
||||||
hasError = true;
|
hasError = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user