1
0
Fork 0
mirror of https://github.com/maziggy/bambuddy.git synced 2026-05-09 08:25:54 +02:00

[GH-ISSUE #1174] [Bug]: Copy Button in PrinterInfoModal failing silently #851

Closed
opened 2026-05-07 00:14:21 +02:00 by BreizhHardware · 3 comments

Originally created by @BurntOutHylian on GitHub (Apr 30, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/1174

Originally assigned to: @maziggy on GitHub.

Component

Bambuddy

Bug Description

The "copy" buttons for IP Address and Serial Number in the printer information modal silently fail when not using secure context.

The root cause appears to be that navigator.clipboard.writeText() requires a secure context (HTTPS or localhost).

For situations where is accessed over plain HTTP (on a private home network for example), navigator.clipboard is either undefined or its methods throw a NotAllowedError. The catch block is silent, so no feedback is given and nothing is copied.

NOTE: I can reproduce this in the current dev branch

Expected Behavior

Contents of the IP Address or Serial Number should be written to the clipboard

Steps to Reproduce

  1. Bambuddy hosted on HTTP via URL or IP other than localhost
  2. Open the Printer Information modal on any printer
  3. Click the Copy icon next to IP Address or Serial Number
  4. Try to paste the contents somewhere else

Printer Model

None

Bambuddy Version

0.2.3.2

SpoolBuddy Version

No response

Printer Firmware Version

No response

Installation Method

Other

Operating System

Linux (Ubuntu/Debian)

Relevant Logs / Support Package

No response

Screenshots

No response

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this bug hasn't already been reported
  • I am using the latest version of Bambuddy
  • My printer is set to LAN Only mode
  • My printer has Developer Mode enabled
Originally created by @BurntOutHylian on GitHub (Apr 30, 2026). Original GitHub issue: https://github.com/maziggy/bambuddy/issues/1174 Originally assigned to: @maziggy on GitHub. ### Component Bambuddy ### Bug Description The "copy" buttons for IP Address and Serial Number in the printer information modal silently fail when not using secure context. The root cause appears to be that navigator.clipboard.writeText() requires a secure context (HTTPS or localhost). For situations where is accessed over plain HTTP (on a private home network for example), navigator.clipboard is either undefined or its methods throw a NotAllowedError. The catch block is silent, so no feedback is given and nothing is copied. NOTE: I can reproduce this in the current dev branch ### Expected Behavior Contents of the IP Address or Serial Number should be written to the clipboard ### Steps to Reproduce 1. Bambuddy hosted on HTTP via URL or IP other than localhost 2. Open the Printer Information modal on any printer 3. Click the Copy icon next to IP Address or Serial Number 4. Try to paste the contents somewhere else ### Printer Model None ### Bambuddy Version 0.2.3.2 ### SpoolBuddy Version _No response_ ### Printer Firmware Version _No response_ ### Installation Method Other ### Operating System Linux (Ubuntu/Debian) ### Relevant Logs / Support Package _No response_ ### Screenshots _No response_ ### Additional Context _No response_ ### Checklist - [x] I have searched existing issues to ensure this bug hasn't already been reported - [x] I am using the latest version of Bambuddy - [x] My printer is set to LAN Only mode - [x] My printer has Developer Mode enabled
BreizhHardware 2026-05-07 00:14:21 +02:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@BurntOutHylian commented on GitHub (Apr 30, 2026):

Suggestion:

File: frontend/src/components/PrinterInfoModal.tsx — CopyButton component (lines 20–28)

Replace the handleCopy function with one that:

  • Tries navigator.clipboard.writeText() first (works on HTTPS / localhost).
  • Falls back to the legacy document.execCommand('copy') approach via a temporary off-screen when the Clipboard API is unavailable.</li> <li>Sets copied = true only when the copy actually succeeds (current behavior is already correct here, just needs the fallback path)</li> </ul> <p dir="auto">I am willing to knock this out if you like.</p> </body></html>
<!-- gh-comment-id:4352564982 --> @BurntOutHylian commented on GitHub (Apr 30, 2026): Suggestion: File: frontend/src/components/PrinterInfoModal.tsx — CopyButton component (lines 20–28) Replace the handleCopy function with one that: - Tries navigator.clipboard.writeText() first (works on HTTPS / localhost). - Falls back to the legacy document.execCommand('copy') approach via a temporary off-screen <textarea> when the Clipboard API is unavailable. - Sets copied = true only when the copy actually succeeds (current behavior is already correct here, just needs the fallback path) I am willing to knock this out if you like.
Author
Owner

@maziggy commented on GitHub (May 1, 2026):

Available/Fixed in branch dev and available with the next release or daily build. Please let me know if it works for you.


If you find Bambuddy useful, please consider giving it a on GitHub — it helps others discover the project!

<!-- gh-comment-id:4358133881 --> @maziggy commented on GitHub (May 1, 2026): Available/Fixed in branch dev and available with the next release or daily build. Please let me know if it works for you. ----- If you find Bambuddy useful, please consider giving it a ⭐ on [GitHub](https://github.com/maziggy/bambuddy) — it helps others discover the project!
Author
Owner

@BurntOutHylian commented on GitHub (May 1, 2026):

Confirmed! Thanks mate

<!-- gh-comment-id:4358949612 --> @BurntOutHylian commented on GitHub (May 1, 2026): Confirmed! Thanks mate
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy-maziggy-1#851
No description provided.