File tree 1 file changed +15
-2
lines changed
packages/core/services/DatabaseService
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -205,13 +205,26 @@ export default abstract class DatabaseService {
205
205
` ) ;
206
206
// Best shot attempt at auto-generating a "File Name"
207
207
// from the "File Path", defaults to full path if this fails
208
+ // description of SQL:
209
+ // * COALESCE - returns the first non-null value in the list
210
+ // * NULLIF - returns null if the two arguments are equal
211
+ // * REGEXP_REPLACE - replaces a substring with another substring
212
+ // so we first replace the last file extension with nothing
213
+ // then check if .ome is at the end of the string and remove it
214
+ // then if it is null if the string is empty
215
+ // which we use COALESCE to replace with the full path if so
208
216
commandsToExecute . push ( `
209
217
UPDATE "${ name } "
210
218
SET "${ PreDefinedColumn . FILE_NAME } " = COALESCE(
211
219
NULLIF(
212
220
REGEXP_REPLACE(
213
- "${ PreDefinedColumn . FILE_PATH } ",
214
- '^.*/([^/]*?)(\\.[^/.]+)?$', '\\1',
221
+ REGEXP_REPLACE(
222
+ "${ PreDefinedColumn . FILE_PATH } ",
223
+ '^.*/([^/]*?)(\\.[^/.]+)?$',
224
+ '\\1',
225
+ ''
226
+ ),
227
+ '\\.ome$',
215
228
''
216
229
),
217
230
''),
You can’t perform that action at this time.
0 commit comments