mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5962] fix: resolve invalid environment validation when publishing docs in personal workspace #5432
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5432
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5962
Author: @sahilkhan09k
Created: 3/7/2026
Status: 🔄 Open
Base:
main← Head:fix-published-docs-environment-validation📝 Commits (2)
5c288bcfix: resolve invalid environment validation when publishing docs in personal workspaceeba920aUpdate packages/hoppscotch-backend/src/published-docs/published-docs.service.ts📊 Changes
1 file changed (+39 additions, -18 deletions)
View changed files
📝
packages/hoppscotch-backend/src/published-docs/published-docs.service.ts(+39 -18)📄 Description
Closes #5952
What's changed
Fixed an issue where publishing documentation in a personal workspace with an environment selected resulted in the error published_docs/invalid_environment.
Updated the fetchEnvironment method in published-docs.service.ts to fetch environments by ID first, and then validate workspace ownership in code.
This prevents false negatives caused by overly strict Prisma query filters while maintaining correct access validation.
Notes to reviewers
The previous implementation queried environments using both id and workspace ownership in the Prisma where clause. In some cases this returned null even when the environment existed.
The new implementation retrieves the environment by ID and then validates ownership (teamID or userUid) explicitly.
This keeps the authorization checks intact while resolving the error when publishing docs from personal workspaces.
Summary by cubic
Fixes published_docs/invalid_environment when publishing docs from personal workspaces by fetching environments by ID and validating ownership in code. Closes #5952.
findUnique(id)forteamEnvironmentanduserEnvironment.teamID/userUidownership checks after fetch.fetchEnvironment; now returns Either with env data to avoid false negatives while keeping access control.Written for commit
eba920a8a1. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.