diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2023-09-28 12:56:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 12:56:16 +0100 |
commit | cc3e1dfbf6afff83601935d32b9165d4d15d567f (patch) | |
tree | 791086a9f9bc91f4f2cda8cea37d31c22a2964ed | |
parent | Bump docker/setup-buildx-action from 2 to 3 (#73) (diff) | |
download | ferdium-server-cc3e1dfbf6afff83601935d32b9165d4d15d567f.tar.gz ferdium-server-cc3e1dfbf6afff83601935d32b9165d4d15d567f.tar.zst ferdium-server-cc3e1dfbf6afff83601935d32b9165d4d15d567f.zip |
fix: delete customIcon when press delete (#78)
backport commit from PR https://github.com/ferdium/ferdium-server/pull/47
-rw-r--r-- | app/Controllers/Http/ServiceController.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/Controllers/Http/ServiceController.js b/app/Controllers/Http/ServiceController.js index b39f79b..5972cd0 100644 --- a/app/Controllers/Http/ServiceController.js +++ b/app/Controllers/Http/ServiceController.js | |||
@@ -202,6 +202,21 @@ class ServiceController { | |||
202 | ...data, | 202 | ...data, |
203 | }; | 203 | }; |
204 | 204 | ||
205 | if (settings.customIcon === 'delete') { | ||
206 | fs.remove( | ||
207 | path.join(Application.tmpPath('uploads'), settings.iconId), | ||
208 | err => { | ||
209 | if (err) { | ||
210 | return console.error(err); | ||
211 | } | ||
212 | }, | ||
213 | ); | ||
214 | |||
215 | settings.iconId = undefined; | ||
216 | settings.customIconVersion = undefined; | ||
217 | settings.customIcon = ''; | ||
218 | } | ||
219 | |||
205 | // Update data in database | 220 | // Update data in database |
206 | await Service.query() | 221 | await Service.query() |
207 | .where('serviceId', id) | 222 | .where('serviceId', id) |