Skip to content

Commit b999ce2

Browse files
authored
Merge pull request #1236 from nextcloud-libraries/fix/rename-mtime
2 parents 3bf6a7d + 54ecf96 commit b999ce2

3 files changed

Lines changed: 0 additions & 12 deletions

File tree

__tests__/files/file.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,47 +103,37 @@ describe('File data change', () => {
103103
source: 'https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg',
104104
mime: 'image/jpeg',
105105
owner: 'emma',
106-
mtime: new Date(Date.UTC(2023, 0, 1, 0, 0, 0)),
107106
})
108107

109108
expect(file.basename).toBe('picture.jpg')
110109
expect(file.dirname).toBe('/')
111110
expect(file.root).toBe('/files/emma/Photos')
112-
expect(file.mtime?.toISOString()).toBe('2023-01-01T00:00:00.000Z')
113111

114112
file.rename('picture-old.jpg')
115113

116114
expect(file.basename).toBe('picture-old.jpg')
117115
expect(file.dirname).toBe('/')
118116
expect(file.source).toBe('https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture-old.jpg')
119117
expect(file.root).toBe('/files/emma/Photos')
120-
121-
// Check that mtime has been updated
122-
expect(file.mtime?.getDate()).toBe(new Date().getDate())
123118
})
124119

125120
test('Moving a file', () => {
126121
const file = new File({
127122
source: 'https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg',
128123
mime: 'image/jpeg',
129124
owner: 'emma',
130-
mtime: new Date(Date.UTC(2023, 0, 1, 0, 0, 0)),
131125
})
132126

133127
expect(file.basename).toBe('picture.jpg')
134128
expect(file.dirname).toBe('/')
135129
expect(file.root).toBe('/files/emma/Photos')
136-
expect(file.mtime?.toISOString()).toBe('2023-01-01T00:00:00.000Z')
137130

138131
file.move('https://cloud.domain.com/remote.php/dav/files/emma/Pictures/picture-old.jpg')
139132

140133
expect(file.basename).toBe('picture-old.jpg')
141134
expect(file.dirname).toBe('/')
142135
expect(file.source).toBe('https://cloud.domain.com/remote.php/dav/files/emma/Pictures/picture-old.jpg')
143136
expect(file.root).toBe('/files/emma/Pictures')
144-
145-
// Check that mtime has been updated
146-
expect(file.mtime?.getDate()).toBe(new Date().getDate())
147137
})
148138

149139
test('Moving a file to an invalid destination throws', () => {

__tests__/files/node.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ describe('Root and paths detection', () => {
640640
})
641641

642642
describe('Move and rename of a node', () => {
643-
644643
test('Move updates the basename', () => {
645644
const file = new File({
646645
source: 'https://cloud.example.com/dav/files/images/emma.jpeg',

lib/files/node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ export abstract class Node {
372372
// this can not be guaranteed, so to be sure users should better refetch the node
373373
this.displayname = this.basename
374374
}
375-
this.updateMtime()
376375
}
377376

378377
/**

0 commit comments

Comments
 (0)