diff --git a/lib/Service/MyMapsService.php b/lib/Service/MyMapsService.php index 8f8047050..ecf9237fb 100644 --- a/lib/Service/MyMapsService.php +++ b/lib/Service/MyMapsService.php @@ -143,6 +143,12 @@ private function node2MyMap($node, $userFolder):array{ return $MyMap; } + /** + * @param $userId + * @return array + * @throws NoUserException + * @throws NotPermittedException + */ public function getAllMyMaps($userId){ $userFolder = $this->root->getUserFolder($userId); $MyMaps = []; diff --git a/src/components/map/ContactsLayer.vue b/src/components/map/ContactsLayer.vue index 7450fe3e9..fd1d24145 100644 --- a/src/components/map/ContactsLayer.vue +++ b/src/components/map/ContactsLayer.vue @@ -20,6 +20,7 @@ import Vue2LeafletMarkerCluster from 'vue2-leaflet-markercluster' import ContactLayer from './ContactLayer' import optionsController from '../../optionsController' import {getToken, isPublic} from "../../utils/common"; +import {splitByNonEscapedComma} from "../../utils"; const CONTACT_MARKER_VIEW_SIZE = 40 @@ -63,9 +64,7 @@ export default { return this.contacts.filter((c) => { if (c.GROUPS) { try { - const cGroups = c.GROUPS.split(/(? { - return name.replace('\\,', ',') - }) + const cGroups = splitByNonEscapedComma(c.GROUPS) for (let i = 0; i < cGroups.length; i++) { // if at least in one enabled group if (this.groups[cGroups[i]].enabled) { diff --git a/src/report-error-map-action.js b/src/report-error-map-action.js index bbf3e3527..f8253915d 100644 --- a/src/report-error-map-action.js +++ b/src/report-error-map-action.js @@ -1,9 +1,9 @@ -OCA.Maps.registerMapsAction({ +OCA.Maps?.registerMapsAction({ label: t('maps', 'Report Error'), icon: 'icon-alert-outline', callback: (location) => { const url = `https://www.openstreetmap.org/note/new?lat=${location.latitude}&lon=${location.longitude}#map=18/${location.latitude}/${location.longitude}` - window.open(url, '_blank').focus() + window.open(url, '_blank')?.focus() }, }) diff --git a/src/utils.js b/src/utils.js index 09f7f6ae2..854f511a7 100644 --- a/src/utils.js +++ b/src/utils.js @@ -9,6 +9,21 @@ function dirname(path) { return path.replace(/\\/g, '/').replace(/\/[^\/]*$/, ''); } +function splitByNonEscapedComma(str) { + // As safari doesn't support lookbehind we need to work with reversed strings + return str.split('') + .reverse() + .join('') + .split(/,(?!(?:(?:\\\\)*\\(?!\\)))/) + .map((g) => { + return g.replaceAll(',\\',',') + .replaceAll('\\\\','\\') + .split('') + .reverse() + .join('') + }).reverse() +} + function Timer(callback, mydelay) { var timerId, start, @@ -382,6 +397,7 @@ export const accented = { export { basename, dirname, + splitByNonEscapedComma, Timer, getLetterColor, hslToRgb, diff --git a/src/views/App.vue b/src/views/App.vue index f608b6168..4a51a7f8f 100644 --- a/src/views/App.vue +++ b/src/views/App.vue @@ -230,11 +230,10 @@ import AppNavigationTracksItem from '../components/AppNavigationTracksItem' import AppNavigationDevicesItem from '../components/AppNavigationDevicesItem' import AppNavigationMyMapsItem from '../components/AppNavigationMyMapsItem' import optionsController from '../optionsController' -import { getLetterColor, hslToRgb, Timer, getDeviceInfoFromUserAgent2, isComputer, isPhone } from '../utils' +import { getLetterColor, hslToRgb, Timer, getDeviceInfoFromUserAgent2, isComputer, isPhone, splitByNonEscapedComma } from '../utils' import { binSearch, getToken, isPublic } from '../utils/common' import { poiSearchData } from '../utils/poiData' import { processGpx } from '../tracksUtils' - import L from 'leaflet' import { geoToLatLng, getFormattedADR } from '../utils/mapUtils' import * as network from '../network' @@ -1316,9 +1315,7 @@ export default { const contactsInGroup = this.contacts.filter((c) => { if (c.GROUPS) { try { - const cGroups = c.GROUPS.split(/[^\\],/).map((name) => { - return name.replace('\\,', ',') - }) + const cGroups = splitByNonEscapedComma(c.GROUPS) for (let i = 0; i < cGroups.length; i++) { // if at least in one enabled group if (cGroups[i] === group) { @@ -1399,9 +1396,7 @@ export default { c.groupList = [] if (c.GROUPS) { try { - const cGroups = c.GROUPS.split(/(? { - return name.replace('\\,', ',') - }) + const cGroups = splitByNonEscapedComma(c.GROUPS) if (cGroups.length > 0) { cGroups.forEach((g) => { c.groupList.push(g)