Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps/dav
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-04-20 07:46:28 +0300
committerChristopher Ng <chrng8@gmail.com>2022-04-20 07:46:28 +0300
commite7f293ba6321c0972d98e18f52d4ba84e89a414b (patch)
tree600ec972e089b42efd78b9704ee526078215ef55 /apps/dav
parente670f692ccc9815ff892753de8b0370dc8e777f9 (diff)
Update naming of address book exports
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/UserMigration/ContactsMigrator.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php
index 065ef05ceea..c94702a0bad 100644
--- a/apps/dav/lib/UserMigration/ContactsMigrator.php
+++ b/apps/dav/lib/UserMigration/ContactsMigrator.php
@@ -207,14 +207,14 @@ class ContactsMigrator implements IMigrator {
try {
/**
- * @var string $name
- * @var string $displayName
- * @var ?string $description
- * @var VCard[] $vCards
- */
+ * @var string $name
+ * @var string $displayName
+ * @var ?string $description
+ * @var VCard[] $vCards
+ */
foreach ($addressBookExports as ['name' => $name, 'displayName' => $displayName, 'description' => $description, 'vCards' => $vCards]) {
- // Set filename to sanitized address book name appended with the date
- $basename = preg_replace('/[^a-zA-Z0-9-_ ]/um', '', $name) . '_' . date('Y-m-d');
+ // Set filename to sanitized address book name
+ $basename = preg_replace('/[^a-z0-9-_]/iu', '', $name);
$exportPath = ContactsMigrator::PATH_ROOT . $basename . '.' . ContactsMigrator::FILENAME_EXT;
$metadataExportPath = ContactsMigrator::PATH_ROOT . $basename . '.' . ContactsMigrator::METADATA_EXT;
@@ -340,11 +340,11 @@ class ContactsMigrator implements IMigrator {
$vCards[] = $vCard;
}
- $splitFilename = explode('_', $addressBookFilename, 2);
+ $splitFilename = explode('.', $addressBookFilename, 2);
if (count($splitFilename) !== 2) {
- throw new ContactsMigratorException("Invalid filename \"$addressBookFilename\", expected filename of the format \"<address_book_name>_YYYY-MM-DD." . ContactsMigrator::FILENAME_EXT . '"');
+ throw new ContactsMigratorException("Invalid filename \"$addressBookFilename\", expected filename of the format \"<address_book_name>." . ContactsMigrator::FILENAME_EXT . '"');
}
- [$initialAddressBookUri, $suffix] = $splitFilename;
+ [$initialAddressBookUri, $ext] = $splitFilename;
/** @var array{displayName: string, description?: string} $metadata */
$metadata = json_decode($importSource->getFileContents($metadataImportPath), true, 512, JSON_THROW_ON_ERROR);