Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Ephemeral
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Volkor Barbarian Warrior
Ephemeral
Commits
37c5bda7
Verified
Commit
37c5bda7
authored
9 months ago
by
Volkor Barbarian Warrior
Browse files
Options
Downloads
Patches
Plain Diff
add debug log for file deletion
parent
8f3a70a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#68
passed with warnings
9 months ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/handlers/delete_file.rs
+6
-3
6 additions, 3 deletions
src/handlers/delete_file.rs
with
6 additions
and
3 deletions
src/handlers/delete_file.rs
+
6
−
3
View file @
37c5bda7
...
@@ -24,18 +24,21 @@ pub async fn delete_file(req: &mut Request, res: &mut Response, depot: &mut Depo
...
@@ -24,18 +24,21 @@ pub async fn delete_file(req: &mut Request, res: &mut Response, depot: &mut Depo
debug!
(
"Received request to delete file: {}"
,
filename
);
debug!
(
"Received request to delete file: {}"
,
filename
);
// Grab the key from the auth handler.
// Grab the
user
key from the auth handler.
let
client_key
=
depot
let
client_key
=
depot
.get
::
<
Key
>
(
"client_key"
)
.get
::
<
Key
>
(
"client_key"
)
.expect
(
"Failed to grab API Key from depot"
)
.expect
(
"Failed to grab API Key from depot"
)
.clone
();
.clone
();
// Grab the
y
key from the d
atabase
.
// Grab the
file's owner
key from the d
b
.
let
owner
=
db
::
check_owner
(
sqlconn
,
filename
)
.await
;
let
owner
=
db
::
check_owner
(
sqlconn
,
filename
)
.await
;
// Compare the client_key and owner.
// Compare the client_key and owner.
let
authorized
=
match
owner
{
let
authorized
=
match
owner
{
Ok
(
owner_key
)
=>
client_key
.uuid
==
owner_key
,
Ok
(
owner_key
)
=>
{
debug!
(
"Deletion attempt: user: {} file owner: {:?}"
,
client_key
.uuid
,
owner_key
);
client_key
.uuid
==
owner_key
}
Err
(
_
)
=>
false
,
Err
(
_
)
=>
false
,
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment