Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
This commit is contained in:
1 parent
288e6e94ac
commit
c1175d389f
699 files changed
+110197
-4117
No files matched your search
@@ -9,68 +9,17 @@ type renamePreviewResponse struct {
|
||||
Targets []string `json:"targets"`
|
||||
}
|
||||
|
||||
func (s *Server) handleRenamePreview(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
) {
|
||||
|
||||
oldPath :=
|
||||
r.URL.Query().Get(
|
||||
"old_path",
|
||||
)
|
||||
|
||||
rows, err :=
|
||||
s.store.DB.Query(`
|
||||
SELECT path
|
||||
FROM paths
|
||||
WHERE path = ?
|
||||
OR path LIKE ?
|
||||
ORDER BY LENGTH(path) ASC
|
||||
`,
|
||||
oldPath,
|
||||
oldPath+"/%",
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
http.Error(
|
||||
w,
|
||||
err.Error(),
|
||||
500,
|
||||
)
|
||||
|
||||
func (s *Server) handleRenamePreview(w http.ResponseWriter, r *http.Request) {
|
||||
if !requirePathMutationPost(w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
defer rows.Close()
|
||||
|
||||
var targets []string
|
||||
|
||||
for rows.Next() {
|
||||
|
||||
var p string
|
||||
|
||||
err := rows.Scan(&p)
|
||||
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
targets =
|
||||
append(
|
||||
targets,
|
||||
p,
|
||||
)
|
||||
snapshot, err := s.authorizedMutationSnapshot(r, "rename", "", r.URL.Query().Get("old_path"), "", true)
|
||||
if err != nil {
|
||||
writePathMutationError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set(
|
||||
"Content-Type",
|
||||
"application/json",
|
||||
)
|
||||
|
||||
json.NewEncoder(w).Encode(
|
||||
renamePreviewResponse{
|
||||
Targets: targets,
|
||||
},
|
||||
)
|
||||
// Return the checked set, not a fresh query that could reveal a newly added
|
||||
// descendant for which the requester has never been authorized.
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(renamePreviewResponse{Targets: snapshot.Paths()})
|
||||
}
|
||||
Reference in new issue
Block a user