nextcloud / nextcloud/maps

[Bug]: Placing photos on custom map produces an error

Open
#1,087 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
JavaScript
Stars
598
Forks
113
PR merge metrics
No merged PRs in 30d

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Placing a photo using the context menu on a custom map (non-default) results in a 500 error on the post request.

Steps to reproduce
  1. Create a new map
  2. Right click and click place photo from context menu
  3. Place a photo
Expected behavior

The photo should be placed on the custom map, as it works on the default map.

Installation method

Official Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install of the server?

Fresh Nextcloud Server install

Is this bug present after an update or on a fresh install of the app?

Fresh Nextcloud Maps install (never installed before)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost:8080"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "26.0.3.2",
        "overwrite.cli.url": "http:\/\/localhost:8080",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true
    }
}
List of activated Apps
Enabled:
  - activity: 2.18.0
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - comments: 1.16.0
  - contacts: 5.3.2
  - contactsinteraction: 1.7.0
  - dashboard: 7.6.0
  - dav: 1.25.0
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - maps: 1.1.0
  - nextcloud_announcements: 1.15.0
  - notifications: 2.14.0
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - photos: 2.2.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - weather_status: 1.6.0
  - workflowengine: 2.8.0
Disabled:
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - encryption: 2.14.0
  - files_external: 1.18.0
  - suspicious_login: 4.4.0
  - twofactor_totp: 8.0.0
  - user_ldap: 1.16.0
Nextcloud Signing status

No response

Nextcloud Logs
{
  "reqId": "2bIJ1UludSI2oPehc0jz",
  "level": 3,
  "time": "2023-07-01T03:00:58+00:00",
  "remoteAddr": "172.18.0.1",
  "user": "*******",
  "app": "index",
  "method": "POST",
  "url": "/apps/maps/photos",
  "message": "Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*maps_photos` WHERE (`user_id` = :dcValue1) AND (`file_id` = :dcValue2)\"; ",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0",
  "version": "26.0.3.2",
  "exception": {
    "Exception": "OCP\\AppFramework\\Db\\DoesNotExistException",
    "Message": "Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*maps_photos` WHERE (`user_id` = :dcValue1) AND (`file_id` = :dcValue2)\"; ",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
        "line": 362,
        "function": "findOneQuery",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          [
            "OC\\DB\\QueryBuilder\\QueryBuilder"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/DB/GeophotoMapper.php",
        "line": 65,
        "function": "findEntity",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          [
            "OC\\DB\\QueryBuilder\\QueryBuilder"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/Service/PhotofilesService.php",
        "line": 294,
        "function": "findByFileIdUserId",
        "class": "OCA\\Maps\\DB\\GeophotoMapper",
        "type": "->",
        "args": [
          350,
          "user"
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/Service/PhotofilesService.php",
        "line": 248,
        "function": "setFilesCoords",
        "class": "OCA\\Maps\\Service\\PhotofilesService",
        "type": "->",
        "args": [
          "user",
          [
            "/Maps/Test/Frog.jpg"
          ],
          [
            30.44408599180477
          ],
          [
            -87.24440574645998
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/Controller/PhotosController.php",
        "line": 147,
        "function": "setPhotosFilesCoords",
        "class": "OCA\\Maps\\Service\\PhotofilesService",
        "type": "->",
        "args": [
          "user",
          [
            "/Maps/Test/Frog.jpg"
          ],
          [
            30.44408599180477
          ],
          [
            -87.24440574645998
          ],
          false
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "placePhotos",
        "class": "OCA\\Maps\\Controller\\PhotosController",
        "type": "->",
        "args": [
          [
            "/Maps/Test/Frog.jpg"
          ],
          [
            30.44408599180477
          ],
          [
            -87.24440574645998
          ],
          false,
          343,
          false
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Maps\\Controller\\PhotosController"
          ],
          "placePhotos"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 183,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Maps\\Controller\\PhotosController"
          ],
          "placePhotos"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Maps\\Controller\\PhotosController",
          "placePhotos",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "maps.photos.placePhotos"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1060,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/maps/photos"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
    "Line": 284,
    "CustomMessage": "--"
  }
}
Browser Console

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/maps/lib/Controller/PhotosController.php, apps/maps/lib/Service/PhotofilesService.php, and apps/maps/lib/DB/GeophotoMapper.php, following the POST trace for placePhotos and the missing maps_photos result. Compare photo placement on a custom map with the default map, and consider the issue done when the custom-map request completes without a 500 error and places the photo.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.