Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #314 from vania-pooh/master
Browse files Browse the repository at this point in the history
Always renaming video file to name after deleting the session (fixes …
  • Loading branch information
vania-pooh authored Dec 18, 2017
2 parents a3beb5d + 098378b commit 7f774e7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions selenoid.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ func create(w http.ResponseWriter, r *http.Request) {
return
}
browser.Caps.VideoScreenSize = videoScreenSize
needToRenameVideo := false
if browser.Caps.Video && browser.Caps.VideoName == "" {
needToRenameVideo = true
finalVideoName := browser.Caps.VideoName
if browser.Caps.Video {
browser.Caps.VideoName = getVideoFileName(videoOutputDir)
}
starter, ok := manager.Find(browser.Caps, requestId)
Expand Down Expand Up @@ -258,9 +257,12 @@ func create(w http.ResponseWriter, r *http.Request) {
}
cancelAndRenameVideo := func() {
cancel()
if browser.Caps.Video && needToRenameVideo {
if browser.Caps.Video {
oldVideoName := filepath.Join(videoOutputDir, browser.Caps.VideoName)
newVideoName := filepath.Join(videoOutputDir, s.ID+videoFileExtension)
if finalVideoName == "" {
finalVideoName = s.ID + videoFileExtension
}
newVideoName := filepath.Join(videoOutputDir, finalVideoName)
err := os.Rename(oldVideoName, newVideoName)
if err != nil {
log.Printf("[%d] [VIDEO_ERROR] [%s]\n", requestId, fmt.Sprintf("Failed to rename %s to %s: %v", oldVideoName, newVideoName, err))
Expand Down

0 comments on commit 7f774e7

Please sign in to comment.