Skip to content

Commit 7be2f5b

Browse files
Pytalbackportbot[bot]
authored andcommitted
Update naming of address book exports
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent add66bc commit 7be2f5b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

apps/dav/lib/UserMigration/ContactsMigrator.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ public function export(IUser $user, IExportDestination $exportDestination, Outpu
207207

208208
try {
209209
/**
210-
* @var string $name
211-
* @var string $displayName
212-
* @var ?string $description
213-
* @var VCard[] $vCards
214-
*/
210+
* @var string $name
211+
* @var string $displayName
212+
* @var ?string $description
213+
* @var VCard[] $vCards
214+
*/
215215
foreach ($addressBookExports as ['name' => $name, 'displayName' => $displayName, 'description' => $description, 'vCards' => $vCards]) {
216-
// Set filename to sanitized address book name appended with the date
217-
$basename = preg_replace('/[^a-zA-Z0-9-_ ]/um', '', $name) . '_' . date('Y-m-d');
216+
// Set filename to sanitized address book name
217+
$basename = preg_replace('/[^a-z0-9-_]/iu', '', $name);
218218
$exportPath = ContactsMigrator::PATH_ROOT . $basename . '.' . ContactsMigrator::FILENAME_EXT;
219219
$metadataExportPath = ContactsMigrator::PATH_ROOT . $basename . '.' . ContactsMigrator::METADATA_EXT;
220220

@@ -340,11 +340,11 @@ public function import(IUser $user, IImportSource $importSource, OutputInterface
340340
$vCards[] = $vCard;
341341
}
342342

343-
$splitFilename = explode('_', $addressBookFilename, 2);
343+
$splitFilename = explode('.', $addressBookFilename, 2);
344344
if (count($splitFilename) !== 2) {
345-
throw new ContactsMigratorException("Invalid filename \"$addressBookFilename\", expected filename of the format \"<address_book_name>_YYYY-MM-DD." . ContactsMigrator::FILENAME_EXT . '"');
345+
throw new ContactsMigratorException("Invalid filename \"$addressBookFilename\", expected filename of the format \"<address_book_name>." . ContactsMigrator::FILENAME_EXT . '"');
346346
}
347-
[$initialAddressBookUri, $suffix] = $splitFilename;
347+
[$initialAddressBookUri, $ext] = $splitFilename;
348348

349349
/** @var array{displayName: string, description?: string} $metadata */
350350
$metadata = json_decode($importSource->getFileContents($metadataImportPath), true, 512, JSON_THROW_ON_ERROR);

0 commit comments

Comments
 (0)