🐛 Fix error when an external user tries to export a shape on viewer (#6252)

This commit is contained in:
Alejandro 2025-04-09 16:48:49 +02:00 committed by GitHub
parent 28a6797595
commit 033ca0d56b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 25 deletions

View file

@ -18,6 +18,7 @@
- Fix design tab has a horizontal scroll [Taiga #10660](https://tree.taiga.io/project/penpot/issue/10660) - Fix design tab has a horizontal scroll [Taiga #10660](https://tree.taiga.io/project/penpot/issue/10660)
- Fix long file names being clipped when longer than allowed length [Taiga #10662](https://tree.taiga.io/project/penpot/issue/10662) - Fix long file names being clipped when longer than allowed length [Taiga #10662](https://tree.taiga.io/project/penpot/issue/10662)
- Fix problem with error detail in toast [Taiga #10519](https://tree.taiga.io/project/penpot/issue/10519) - Fix problem with error detail in toast [Taiga #10519](https://tree.taiga.io/project/penpot/issue/10519)
- Fix view mode error when an external user tries to export something from a prototype using a shared link [Taiga #10251](https://tree.taiga.io/project/penpot/issue/10251)
## 2.6.1 ## 2.6.1

View file

@ -474,7 +474,7 @@
(update page :objects update-vals #(dissoc % :thumbnail))) (update page :objects update-vals #(dissoc % :thumbnail)))
(defn get-page (defn get-page
[{:keys [::db/conn] :as cfg} {:keys [profile-id file-id page-id object-id] :as params}] [{:keys [::db/conn] :as cfg} {:keys [profile-id file-id page-id object-id share-id] :as params}]
(when (and (uuid? object-id) (when (and (uuid? object-id)
(not (uuid? page-id))) (not (uuid? page-id)))
@ -482,12 +482,15 @@
:code :params-validation :code :params-validation
:hint "page-id is required when object-id is provided")) :hint "page-id is required when object-id is provided"))
(let [team (teams/get-team conn (let [perms (get-permissions conn profile-id file-id share-id)
:profile-id profile-id
:file-id file-id)
file (get-file cfg file-id) file (get-file cfg file-id)
proj (db/get conn :project {:id (:project-id file)})
team (-> (db/get conn :team {:id (:team-id proj)})
(teams/decode-row))
_ (-> (cfeat/get-team-enabled-features cf/flags team) _ (-> (cfeat/get-team-enabled-features cf/flags team)
(cfeat/check-client-features! (:features params)) (cfeat/check-client-features! (:features params))
(cfeat/check-file-features! (:features file))) (cfeat/check-file-features! (:features file)))
@ -499,6 +502,11 @@
(deref page) (deref page)
page)))] page)))]
(when-not perms
(ex/raise :type :not-found
:code :object-not-found
:hint "object not found"))
(cond-> (prune-thumbnails page) (cond-> (prune-thumbnails page)
(some? object-id) (some? object-id)
(prune-objects object-id)))) (prune-objects object-id))))

View file

@ -143,17 +143,7 @@
nil) nil)
(do (do
(st/emit! (ptk/reify ::initialize-render-objects (st/emit! (fetch-objects-bundle :file-id file-id :page-id page-id :share-id share-id :object-id object-id))
ptk/WatchEvent
(watch [_ _ stream]
(rx/merge
(rx/of (fetch-team :file-id file-id))
(->> stream
(rx/filter (ptk/type? ::team-fetched))
(rx/observe-on :async)
(rx/map (constantly params))
(rx/map fetch-objects-bundle))))))
(if (uuid? object-id) (if (uuid? object-id)
(mf/html (mf/html