Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Performer image broken after merge #16

Open
DogmaDragon opened this issue Dec 13, 2024 · 8 comments
Open

[Bug] Performer image broken after merge #16

DogmaDragon opened this issue Dec 13, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@DogmaDragon
Copy link

To reproduce

  1. Select Merge into or Merge from
  2. Select existing image to keep
  3. Confirm
  4. Performer image is broken after the merge

Inspecting before/after image URL only shows that the value of t= in the URL changed.

Windows
v0.27.2
Database type file system

@DogmaDragon
Copy link
Author

Narrowed down the issue to blob created being invalid. It seems to be running into a login wall and saving that as the blob instead of the encoded image.

Source of the blob after merge

<!DOCTYPE html>
<html lang="en">
<head>
    <base href="/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Login</title>

    <link rel="shortcut icon" href="data:,">
    <link rel="stylesheet" href="login/login.css">
    <link rel="stylesheet" href="css">
</head>
<body class="login">

    <div class="dialog">
        <div class="card">
            <form action="login" method="POST">
                <div class="form-group">
                    <label for="username"><h6>Username</h6></label>
                    <input class="text-input form-control" id="username" name="username" type="text" placeholder="Username" />
                </div>
                <div class="form-group">
                    <label for="password"><h6>Password</h6></label>
                    <input class="text-input form-control" id="password" name="password" type="password" placeholder="Password" />
                </div>
                <div class="login-error">
                    
                </div>

                <input type="hidden" name="returnURL" value="/performer/9640/image?t=1734116139" />

                <div>
                    <input class="btn btn-primary" type="submit" value="Login">
                </div>
            </form>
        </div>
    </div>

</body>
</html>

@Valkyr-JS Valkyr-JS added the bug Something isn't working label Dec 13, 2024
@Valkyr-JS
Copy link
Owner

Strange, I can't replicate though I'm on Docker. Is any error coming up in the Stash log?

@DogmaDragon
Copy link
Author

Nothing. I also checked browser console, also no errors from what I can see.

@Valkyr-JS
Copy link
Owner

Has it happened multiple times? I'm gonna set up a windows build, see if I can replicate it there.

@Valkyr-JS
Copy link
Owner

Valkyr-JS commented Dec 15, 2024

Could you try replacing the plugin files with these? I've made a few changes to the way merges are handled. May not work, but it's all I can think of so far.

Updated: StashMergers.zip

@DogmaDragon
Copy link
Author

Has it happened multiple times? I'm gonna set up a windows build, see if I can replicate it there.

Every single time. I can reproduce it indefinitely.

Could you try replacing the plugin files with these? I've made a few changes to the way merges are handled. May not work, but it's all I can think of so far.

Updated: StashMergers.zip

Same issue. Ran in twice.

9697 merged into 9698.
9699 merged into 9700

Details from 9697 merge into 9698.

It creates a new blob ebbe1dc12daa33b0b048d210e77b3a67 sets the URL to http://localhost:port/performer/9697/image?t=1734356528 but the blob doesn't contain the image. It has the raw HTML of the login page.

<!DOCTYPE html>
<html lang="en">
<head>
    <base href="/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Login</title>

    <link rel="shortcut icon" href="data:,">
    <link rel="stylesheet" href="login/login.css">
    <link rel="stylesheet" href="css">
</head>
<body class="login">

    <div class="dialog">
        <div class="card">
            <form action="login" method="POST">
                <div class="form-group">
                    <label for="username"><h6>Username</h6></label>
                    <input class="text-input form-control" id="username" name="username" type="text" placeholder="Username" />
                </div>
                <div class="form-group">
                    <label for="password"><h6>Password</h6></label>
                    <input class="text-input form-control" id="password" name="password" type="password" placeholder="Password" />
                </div>
                <div class="login-error">
                    
                </div>

                <input type="hidden" name="returnURL" value="/performer/9698/image?t=1734356486" />

                <div>
                    <input class="btn btn-primary" type="submit" value="Login">
                </div>
            </form>
        </div>
    </div>

</body>
</html>

Here is the websocket raw log

{"payload":{"data":{"loggingSubscribe":[{"level":"Trace","message":"SQL [0s]: SELECT COUNT(*) as count FROM (SELECT image_blob FROM performers WHERE id = ? AND image_blob IS NOT NULL LIMIT 1), args: [9697]"},{"level":"Trace","message":"SQL [0s]: SELECT COUNT(*) as count FROM (SELECT DISTINCT images.id FROM images LEFT JOIN performers_images AS performers_join ON performers_join.image_id = images.id WHERE (performers_join.performer_id IN (?))) as temp, args: [9697]"},{"level":"Trace","message":"SQL [2.0014ms]: SELECT COUNT(*) as count FROM (SELECT DISTINCT galleries.id FROM galleries LEFT JOIN performers_galleries AS performers_join ON performers_join.gallery_id = galleries.id WHERE (performers_join.performer_id IN (?))) as temp, args: [9697]"},{"level":"Trace","message":"SQL [0s]: SELECT COUNT(DISTINCT groups_scenes.group_id) AS count\nFROM groups_scenes\nINNER JOIN performers_scenes ON performers_scenes.scene_id = groups_scenes.scene_id\nWHERE performers_scenes.performer_id = ?\n, args: [9697]"},{"level":"Trace","message":"SQL [1.9997ms]: WITH performer(id) AS (VALUES(9697)), performer_performers AS (SELECT performers_scenes2.performer_id FROM performers_scenes\n\t\t\tINNER JOIN performers_scenes AS performers_scenes2 ON performers_scenes.scene_id = performers_scenes2.scene_id\n\t\t\tINNER JOIN performer ON performers_scenes.performer_id = performer.id\n\t\t\tWHERE performers_scenes2.performer_id != performer.id UNION SELECT performers_images2.performer_id FROM performers_images\n\t\t\tINNER JOIN performers_images AS performers_images2 ON performers_images.image_id = performers_images2.image_id\n\t\t\tINNER JOIN performer ON performers_images.performer_id = performer.id\n\t\t\tWHERE performers_images2.performer_id != performer.id UNION SELECT performers_galleries2.performer_id FROM performers_galleries\n\t\t\tINNER JOIN performers_galleries AS performers_galleries2 ON performers_galleries.gallery_id = performers_galleries2.gallery_id\n\t\t\tINNER JOIN performer ON performers_galleries.performer_id = performer.id\n\t\t\tWHERE performers_galleries2.performer_id != performer.id) SELECT COUNT(*) as count FROM (SELECT DISTINCT performers.id FROM performers INNER JOIN performer_performers ON performers.id = performer_performers.performer_id) as temp, args: []"},{"level":"Trace","message":"SQL [0s]: SELECT performers_tags.tag_id as id from performers_tags INNER JOIN tags ON tags.id = performers_tags.tag_id WHERE performer_id = ? ORDER BY tags.name ASC, args: [9697]"},{"level":"Trace","message":"SQL [0s]: SELECT `performer_urls`.`url` FROM `performer_urls` WHERE (`performer_urls`.`performer_id` = 9697) ORDER BY `performer_urls`.`position` ASC, args: []"},{"level":"Trace","message":"SQL [0s]: SELECT `performer_aliases`.`alias` FROM `performer_aliases` WHERE (`performer_aliases`.`performer_id` = 9697), args: []"},{"level":"Trace","message":"SQL [0s]: SELECT COUNT(*) FROM `performers_scenes` WHERE (`performers_scenes`.`performer_id` = 9697), args: []"},{"level":"Trace","message":"SQL [0s]: SELECT COUNT(*) FROM `scenes` INNER JOIN `scenes_o_dates` ON (`scenes`.`id` = `scenes_o_dates`.`scene_id`) INNER JOIN `performers_scenes` ON (`scenes`.`id` = `performers_scenes`.`scene_id`) WHERE (`performers_scenes`.`performer_id` = 9697), args: []"},{"level":"Trace","message":"SQL [0s]: SELECT COALESCE(SUM(`o_counter`), 0) FROM `images` INNER JOIN `performers_images` ON (`images`.`id` = `performers_images`.`image_id`) WHERE (`performers_images`.`performer_id` = 9697), args: []"},{"level":"Trace","message":"SQL [0s]: SELECT `endpoint`, `stash_id` FROM `performer_stash_ids` WHERE (`performer_stash_ids`.`performer_id` = 9697), args: []"},{"level":"Trace","message":"SQL [0s]: SELECT COUNT(DISTINCT temp.id) as total, SUM(temp.duration) as duration, SUM(temp.size) as size FROM (SELECT DISTINCT scenes.id, COALESCE(video_files.duration, 0) as duration, COALESCE(files.size, 0) as size FROM scenes LEFT JOIN performers_scenes AS performers_join ON performers_join.scene_id = scenes.id LEFT JOIN scenes_files ON scenes_files.scene_id = scenes.id LEFT JOIN video_files ON scenes_files.file_id = video_files.file_id LEFT JOIN files ON scenes_files.file_id = files.id WHERE (performers_join.performer_id IN (?)) GROUP BY scenes.id  HAVING (count(distinct performers_join.performer_id) IS 1)) as temp, args: [9697]"},{"level":"Trace","message":"SQL [0s]: SELECT DISTINCT scenes.id FROM scenes LEFT JOIN performers_scenes AS performers_join ON performers_join.scene_id = scenes.id WHERE (performers_join.performer_id IN (?)) GROUP BY scenes.id  HAVING (count(distinct performers_join.performer_id) IS 1) ORDER BY scenes.date DESC, COALESCE(scenes.title, scenes.id) COLLATE NATURAL_CI ASC LIMIT 40 OFFSET 0 , args: [9697]"}]}},"id":"34650ed8-abcc-466c-a3f8-3a7aacda8af3","type":"next"}

Some more details about my setup in case it helps:
Runs on bare-metal Windows 10
Runs on http://localhost
Authentication is set
Latest Stash release stashapp/stash@76648fe (not develop)

No errors in the browser console
Nothing in the Stash logs

@Valkyr-JS
Copy link
Owner

Valkyr-JS commented Dec 16, 2024

Right, must be the authentication. I'll take a look at it this evening, hopefully should be pretty simple to resolve.

Edit: Yep, I added login credentials and was able to replicate it straight away.

@Valkyr-JS
Copy link
Owner

Tried resolving this but it looks like its an issue on Stash's end, unfortunately. The exact issue has been mentioned on the Stash Discord and reported as a bug on Github.

I tried adding the API key to the request but it doesn't make a difference. I'll add a warning in the readme for now that unfortunately this plugin only works without authentication. I'll keep an eye on the Github issue and Discord, and if any suggestions come up I'll give them a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants