summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-13 17:08:50 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-13 17:08:50 +0300
commit282e9c18d9d3b726cce3d2ef0babc88029661cb8 (patch)
tree7889a5495c1143e93df3c3ac3a0dd50b53d54f68 /src/mir_app
parentdbbec79f16da294890420538ec3957115d2ba820 (diff)
fixes #4172 (Facebook: avatar support is broken)
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/netlib.h1
-rw-r--r--src/mir_app/src/netlib_http.cpp9
2 files changed, 9 insertions, 1 deletions
diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h
index 5f8f35bf0c..bd122db088 100644
--- a/src/mir_app/src/netlib.h
+++ b/src/mir_app/src/netlib.h
@@ -103,6 +103,7 @@ class MFileChunkStorage : public MChunkHandler
public:
MFileChunkStorage(const MFilePath &pwszFileName, pfnDownloadCallback, void*);
+ ~MFileChunkStorage();
__forceinline operator bool() const { return fileId != -1; }
};
diff --git a/src/mir_app/src/netlib_http.cpp b/src/mir_app/src/netlib_http.cpp
index cfe28998f1..b34346f768 100644
--- a/src/mir_app/src/netlib_http.cpp
+++ b/src/mir_app/src/netlib_http.cpp
@@ -1138,12 +1138,19 @@ MFileChunkStorage::MFileChunkStorage(const MFilePath &_1, pfnDownloadCallback _2
fileId = _wopen(_1, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
}
+MFileChunkStorage::~MFileChunkStorage()
+{
+ if (fileId != -1) {
+ _close(fileId);
+ fileId = -1;
+ }
+}
+
void MFileChunkStorage::apply(MHttpResponse *nlhr)
{
if (fileId != -1) {
nlhr->resultCode = 200;
nlhr->body = "OK";
- _close(fileId);
}
else nlhr->resultCode = 500;
}