Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
f5de5d5e
Commit
f5de5d5e
authored
6 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
fix check playlist existence before deleting it
parent
fb95ea46
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
store/files.go
+1
-0
1 addition, 0 deletions
store/files.go
store/playlists.go
+2
-1
2 additions, 1 deletion
store/playlists.go
with
3 additions
and
1 deletion
store/files.go
+
1
−
0
View file @
f5de5d5e
...
@@ -100,6 +100,7 @@ func (st *Store) GetFileUsage(group string, id uint64) (playlists Playlists, err
...
@@ -100,6 +100,7 @@ func (st *Store) GetFileUsage(group string, id uint64) (playlists Playlists, err
func
(
st
*
Store
)
DeleteFile
(
group
string
,
id
uint64
)
error
{
func
(
st
*
Store
)
DeleteFile
(
group
string
,
id
uint64
)
error
{
tx
:=
st
.
db
.
Begin
()
tx
:=
st
.
db
.
Begin
()
// make sure the file exists and actually belongs to <group>
if
err
:=
tx
.
Where
(
"group_name = ?"
,
group
)
.
First
(
&
File
{},
id
)
.
Error
;
err
!=
nil
{
if
err
:=
tx
.
Where
(
"group_name = ?"
,
group
)
.
First
(
&
File
{},
id
)
.
Error
;
err
!=
nil
{
tx
.
Rollback
()
tx
.
Rollback
()
return
err
return
err
...
...
This diff is collapsed.
Click to expand it.
store/playlists.go
+
2
−
1
View file @
f5de5d5e
...
@@ -109,7 +109,8 @@ func (st *Store) UpdatePlaylist(group string, id uint64, playlist Playlist) (*Pl
...
@@ -109,7 +109,8 @@ func (st *Store) UpdatePlaylist(group string, id uint64, playlist Playlist) (*Pl
func
(
st
*
Store
)
DeletePlaylist
(
group
string
,
id
uint64
)
(
err
error
)
{
func
(
st
*
Store
)
DeletePlaylist
(
group
string
,
id
uint64
)
(
err
error
)
{
tx
:=
st
.
db
.
Begin
()
tx
:=
st
.
db
.
Begin
()
if
err
=
tx
.
First
(
&
Playlist
{},
id
)
.
Error
;
err
!=
nil
{
// make sure the playlist exists and actually belongs to <group>
if
err
=
tx
.
Where
(
"group_name = ?"
,
group
)
.
First
(
&
Playlist
{},
id
)
.
Error
;
err
!=
nil
{
tx
.
Rollback
()
tx
.
Rollback
()
return
return
}
}
...
...
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