<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>218519</bug_id>
          
          <creation_ts>2020-11-03 09:06:39 -0800</creation_ts>
          <short_desc>[WPE][GTK] Can&apos;t paste image data (like image/png) from the clipboard in WebKit browsers</short_desc>
          <delta_ts>2025-10-21 06:37:12 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Miikka">miikka.veijonen</reporter>
          <assigned_to name="Michael Catanzaro">mcatanzaro</assigned_to>
          <cc>achristensen</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cgarcia</cc>
    
    <cc>lwbaqueros</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>nazifts</cc>
    
    <cc>nekohayo</cc>
    
    <cc>peter.bittner</cc>
    
    <cc>prodrigestivill</cc>
    
    <cc>sonny</cc>
    
    <cc>ttys3.rust</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>woodlxf00</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1704025</commentid>
    <comment_count>0</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2020-11-03 09:06:39 -0800</bug_when>
    <thetext>I&apos;m unable to paste any images from my clipboard into browser windows using WebKitGtk (like Epiphany or WebKitGtk MiniBrowser).

I&apos;ve verified that the data certainly is in the clipboard because following commands:
xclip -selection clipboard -t image/png -o &gt; image.png
xclip -selection clipboard -t image/bmp -o &gt; image.bmp
outputs proper bitmap or PNG files. And I&apos;m also able to paste the data in Gimp, Firefox, LibreOffice and Chromium. Only the WebKitGtk based browser does not work properly so I assume the problem is with my WebKitGtk. I compiled webkitgtk-2.30.2 and Epiphany from git (2020-10-29) manually but the problem still exists in Epiphany and in the MiniBrowser.

Could there be some library I&apos;m missing or something?

I found one bug that could relate: https://bugs.webkit.org/show_bug.cgi?id=211519 but in there there is broken image area when the data has been pasted. With my problem the browser does nothing when I hit Ctrl+V (like in chat/email window or in imgur.com).

I compiled WebKitGtk with the following arguments:
cmake .. -DCMAKE_BUILD_TYPE=Release -DPORT=GTK -DENABLE_MINIBROWSER=ON -DCMAKE_EXE_LINKER_FLAGS=&quot;-Wl,--as-needed -Wl,-z,now -pthread&quot; -DCMAKE_MODULE_LINKER_FLAGS=&quot;-Wl,--as-needed -Wl,-z,now -pthread&quot; -DCMAKE_SHARED_LINKER_FLAGS=&quot;-Wl,--as-needed -Wl,-z,now -pthread&quot; -DUSE_WOFF2=false -DENABLE_MEDIA_SOURCE=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3:
-- Enabled features:
--  ENABLE_ACCELERATED_2D_CANVAS .................. OFF
--  ENABLE_BUBBLEWRAP_SANDBOX                       ON
--  ENABLE_DRAG_SUPPORT ........................... ON
--  ENABLE_GLES2                                    OFF
--  ENABLE_GRAPHICS_CONTEXT_GL .................... ON
--  ENABLE_GTKDOC                                   OFF
--  ENABLE_INTROSPECTION .......................... ON
--  ENABLE_MEDIA_SOURCE                             OFF
--  ENABLE_MINIBROWSER ............................ ON
--  ENABLE_QUARTZ_TARGET                            OFF
--  ENABLE_SHAREABLE_RESOURCE ..................... ON
--  ENABLE_SPELLCHECK                               ON
--  ENABLE_TOUCH_EVENTS ........................... ON
--  ENABLE_VIDEO                                    ON
--  ENABLE_WAYLAND_TARGET ......................... ON
--  ENABLE_WEBDRIVER                                ON
--  ENABLE_WEB_AUDIO .............................. ON
--  ENABLE_WEB_CRYPTO                               ON
--  ENABLE_X11_TARGET ............................. ON
--  USE_GTK4                                        OFF
--  USE_LIBHYPHEN ................................. ON
--  USE_LIBNOTIFY                                   ON
--  USE_LIBSECRET ................................. ON
--  USE_OPENJPEG                                    ON
--  USE_SYSTEMD ................................... ON
--  USE_WOFF2                                       false
--  USE_WPE_RENDERER .............................. ON
-- Configuring done
-- Generating done

Distro: openSUSE Leap 15.2
DE: KDE/Plasma 5.18.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1705162</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-11-06 01:07:17 -0800</bug_when>
    <thetext>Could you try pasting to MiniBrowser started with -e (editor mode). I guess this is on xorg?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1708266</commentid>
    <comment_count>2</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2020-11-17 09:37:18 -0800</bug_when>
    <thetext>Yes, it&apos;s Xorg I&apos;m using. In the editor mode the pasting of image data from the clipboard works!

I also created a separate bug report to Epiphany but it wasn&apos;t correct place to submit that: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1388

I&apos;ve also noticed that pasting works on Evolution email client when I&apos;m writing/composing email. I can embed images from clipboard directly into email.

Way to reproduce: Select and copy some image data from Gimp into clipboard for example, in Epiphany go to imgur.com and create new post, hit CTRL+V: nothing happens. If I do this in Chromium or Firefox the browser delivers the image data to imgur and the new post gets created.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1710566</commentid>
    <comment_count>3</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2020-11-30 04:21:42 -0800</bug_when>
    <thetext>Is there anything I should try? I&apos;ve been able to reproduce this on openSUSE 15.2 Leap and on Debian testing (Bullseye).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1712830</commentid>
    <comment_count>4</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2020-12-08 10:37:38 -0800</bug_when>
    <thetext>Bump!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1719594</commentid>
    <comment_count>5</comment_count>
    <who name="Sonny Piers">sonny</who>
    <bug_when>2021-01-14 08:04:08 -0800</bug_when>
    <thetext>I ran some tests

Everything works fine on MiniBrowser -e (both Wayland and Xorg)

However, on non-editable context it is broken on both Wayland and Xorg.

The paste event https://w3c.github.io/clipboard-apis/#clipboard-event-paste is emitted with a DataTransferItemList length of 0.

I used https://codepen.io/tmrDevelops/pen/YxGQaW to reproduce.

To clarify, file:// pasting works fine - only pasting [Image] data is broken.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1719597</commentid>
    <comment_count>6</comment_count>
    <who name="Sonny Piers">sonny</who>
    <bug_when>2021-01-14 08:15:26 -0800</bug_when>
    <thetext>Actually a much better test case is to run 

window.addEventListener(&apos;paste&apos;, function(e){
  console.log(e.clipboardData.items.length)
});

in the JavaScript console and then paste data.

Both on editable and non-editable contexts it logs 0 when pasting [Image].</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1719620</commentid>
    <comment_count>7</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-01-14 09:20:28 -0800</bug_when>
    <thetext>Hi Sonny! Thanks, I&apos;m glad to hear that someone else was able to reproduce this. So I can be sure that it does not happen only with my setup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1721133</commentid>
    <comment_count>8</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-01-21 05:33:37 -0800</bug_when>
    <thetext>I can reproduce it now. I don&apos;t think this is specific to the GTK port. DataTransfer::items() only returns items that are considered to be safe for DOM, see:

bool Pasteboard::isSafeTypeForDOMToReadAndWrite(const String&amp; type)
{
    return type == &quot;text/plain&quot; || type == &quot;text/html&quot; || type == &quot;text/uri-list&quot;;
}

So, images are not allowed. I don&apos;t know if that&apos;s WebKit specific or part of a spec, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1721489</commentid>
    <comment_count>9</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-01-21 22:11:55 -0800</bug_when>
    <thetext>Thanks Carlos.

I tried to modify that particular code in Source/WebCore/platform/Pasteboard.cpp:
bool Pasteboard::isSafeTypeForDOMToReadAndWrite(const String&amp; type)
{   
    return type == &quot;text/plain&quot; || type == &quot;text/html&quot; || type == &quot;text/uri-list&quot;;
}
to:
bool Pasteboard::isSafeTypeForDOMToReadAndWrite(const String&amp; type)
{   
    return type == &quot;text/plain&quot; || type == &quot;text/html&quot; || type == &quot;text/uri-list&quot; || type == &quot;image/apng&quot; || type == &quot;image/avif&quot; || type == &quot;image/gif&quot; || type == &quot;image/jpeg&quot; || type == &quot;image/png&quot; || type == &quot;image/svg+xml&quot; || type == &quot;image/webp&quot;;
}

And built the WebKitGtk but that didn&apos;t fix this issue at least (still unable to paste any image data from the clipboard into WebKit MiniBrowser or Epiphany).

Could this issue be related to these changes?:
https://webkit.org/blog/8170/clipboard-api-improvements/
https://webkit.org/blog/10855/async-clipboard-api/

What do you think, should I move this issue to some other Component or create completely new issue and ref to this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1721490</commentid>
    <comment_count>10</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-01-21 22:18:14 -0800</bug_when>
    <thetext>Actually I found also something interesting from the file: Source/WebCore/Modules/async-clipboard/Clipboard.cpp:

    if (type == &quot;text/uri-list&quot;_s) {
        String title;
        resultAsString = activePasteboard().readURL(itemIndex, title).string();
    }

    if (type == &quot;text/plain&quot;_s) {
        PasteboardPlainText plainTextReader;
        activePasteboard().read(plainTextReader, PlainTextURLReadingPolicy::IgnoreURL, itemIndex);
        resultAsString = WTFMove(plainTextReader.text);
    }

    if (type == &quot;text/html&quot;_s) {
        WebContentMarkupReader markupReader { *frame };
        activePasteboard().read(markupReader, WebContentReadingPolicy::OnlyRichTextTypes, itemIndex);
        resultAsString = WTFMove(markupReader.markup);
    }   

    // FIXME: Support reading custom data.
    if (updateSessionValidity() == SessionIsValid::No || resultAsString.isNull()) {
        promise-&gt;reject(NotAllowedError);
        return;
    }

Could that be related to this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1721492</commentid>
    <comment_count>11</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-01-21 22:43:32 -0800</bug_when>
    <thetext>And this:

File: Source/WebCore/platform/gtk/PasteboardGtk.cpp:
void Pasteboard::read(PasteboardPlainText&amp; text, PlainTextURLReadingPolicy, Optional&lt;size_t&gt;):
    static const ASCIILiteral imageTypes[] = { &quot;image/png&quot;_s, &quot;image/jpeg&quot;_s, &quot;image/gif&quot;_s, &quot;image/bmp&quot;_s, &quot;image/vnd.microsoft.icon&quot;_s, &quot;image/x-icon&quot;_s };
    for (const auto&amp; imageType : imageTypes) {
        if (types.contains(imageType)) {
            auto buffer = platformStrategies()-&gt;pasteboardStrategy()-&gt;readBufferFromClipboard(m_name, imageType);
            if (!buffer-&gt;isEmpty() &amp;&amp; reader.readImage(buffer.releaseNonNull(), imageType))
                return;
        }
    }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1721507</commentid>
    <comment_count>12</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-01-22 00:41:05 -0800</bug_when>
    <thetext>What is probably failing after allowing images is getAsFile(), I don&apos;t know why that should work for images, but it&apos;s returning null I&apos;m afraid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1727447</commentid>
    <comment_count>13</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-02-10 00:20:03 -0800</bug_when>
    <thetext>Should I move this bug report from WebKitGTK Component to something else?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1766323</commentid>
    <comment_count>14</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-06-03 02:05:38 -0700</bug_when>
    <thetext>Hmm, is there any progress with this? I think all of my WebKit based browsers on Linux are lacking the support of pasting images from the clipboard because of this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1775977</commentid>
    <comment_count>15</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-07-09 06:25:23 -0700</bug_when>
    <thetext>I already found a way to fix up this, and it works good. Need sometime to figure out how to create a patch, seems that submit a patch to webkit is a little bit difficult to me. (I mean, in github I only need one click and submit the Pull Request)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1775994</commentid>
    <comment_count>16</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-07-09 07:54:00 -0700</bug_when>
    <thetext>Hi, there are guidelines for contributing patches here: https://webkit.org/contributing-code/

It would also be good to mention what exactly you&apos;ve discovered....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776205</commentid>
    <comment_count>17</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-07-11 02:34:49 -0700</bug_when>
    <thetext>(In reply to 荒野無燈 from comment #15)
&gt; I already found a way to fix up this, and it works good. Need sometime to
&gt; figure out how to create a patch, seems that submit a patch to webkit is a
&gt; little bit difficult to me. (I mean, in github I only need one click and
&gt; submit the Pull Request)

Sounds good! Could you please share the patch somewhere so I can test it too?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776208</commentid>
    <comment_count>18</comment_count>
      <attachid>433288</attachid>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-07-11 06:33:22 -0700</bug_when>
    <thetext>Created attachment 433288
fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get no files, this fix makes ctrl + v paste image under GTK  works

in Source/WebCore/dom/DataTransfer.cpp  DataTransfer::filesFromPasteboardAndItemList

```cpp
 WebCorePasteboardFileReader reader(context);
 m_pasteboard-&gt;read(reader);
 files = WTFMove(reader.files);
```

it only calls `void Pasteboard::read(PasteboardFileReader&amp; reader, std::optional&lt;size_t&gt;)`, 

and `Pasteboard::read(PasteboardWebContentReader&amp; reader, WebContentReadingPolicy policy, std::optional&lt;size_t&gt;)` got no chances, so the image data dit not got read.

this patch is a workaround to fixup the problem (tested under webkitgtk 2.32.0 and 2.32.1).

by patching `void Pasteboard::read(PasteboardFileReader&amp; reader, std::optional&lt;size_t&gt;)`,  and call `WebCorePasteboardFileReader::readBuffer`, we can make `DataTransferItem::getAsFile()` get the image file data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776209</commentid>
    <comment_count>19</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-07-11 06:39:53 -0700</bug_when>
    <thetext>I have some working builds if you need quick verify if it works.

-----------------------------------------------------------

libwebkit2gtk-4.0-37_2.32.0 for Ubuntu 20.04.2:

curl -LO https://github.com/ttys3/lark-for-linux/releases/download/v0.9.4/libwebkit2gtk-4.0-37_2.32.0-patched-ubuntu-20.04.2-deb.tar.xz

tar xvf libwebkit2gtk-4.0-37_2.32.0-patched-ubuntu-20.04.2-deb.tar.xz

cd libwebkit2gtk-4.0-37_2.32.0*

sudo apt install -y --allow-downgrades ./*.deb


use https://github.com/ttys3/lark-for-linux/releases/download/v0.9.4/libwebkit2gtk-4.0-37_2.32.0-patched-ubuntu-21.04-gnome40-deb.tar.xz
if you are Ubuntu 21.04 and has GNOME 40 installed.
-------------------------------------------------------------

download and install https://github.com/ttys3/lark-for-linux/releases/download/v0.9.4/webkit2gtk-2.32.1-1-x86_64.pkg.tar.zst if you are a ArchLinux user.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776211</commentid>
    <comment_count>20</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-07-11 07:13:50 -0700</bug_when>
    <thetext>(In reply to 荒野無燈 from comment #18)
&gt; Created attachment 433288 [details]
&gt; fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get
&gt; no files, this fix makes ctrl + v paste image under GTK  works

I have no doubt that it works, but that can&apos;t be the correct fix. readFilePathsFromClipboard should do what it says, not more. I haven&apos;t looked closely, but you might be one level too far down from the right place to fix this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776212</commentid>
    <comment_count>21</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-07-11 07:46:57 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #20)
&gt; (In reply to 荒野無燈 from comment #18)
&gt; &gt; Created attachment 433288 [details]
&gt; &gt; fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get
&gt; &gt; no files, this fix makes ctrl + v paste image under GTK  works
&gt; 
&gt; I have no doubt that it works, but that can&apos;t be the correct fix.
&gt; readFilePathsFromClipboard should do what it says, not more. I haven&apos;t
&gt; looked closely, but you might be one level too far down from the right place
&gt; to fix this.

Thanks for the quick reply. I think you are right, this is not a correct fix.

I&apos;m not familiar with the WebKit code at all. And I&apos;m just a normal user which wait the correct patch for about 8 months or maybe longer.

I can not do further investigation to finish the right patch.

And hope someone will continue the work.

Thank you all guys.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776291</commentid>
    <comment_count>22</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-07-12 04:48:05 -0700</bug_when>
    <thetext>(In reply to 荒野無燈 from comment #18)
&gt; Created attachment 433288 [details]
&gt; fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get
&gt; no files, this fix makes ctrl + v paste image under GTK  works
&gt; 
&gt; in Source/WebCore/dom/DataTransfer.cpp 
&gt; DataTransfer::filesFromPasteboardAndItemList
&gt; 
&gt; ```cpp
&gt;  WebCorePasteboardFileReader reader(context);
&gt;  m_pasteboard-&gt;read(reader);
&gt;  files = WTFMove(reader.files);
&gt; ```
&gt; 
&gt; it only calls `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; std::optional&lt;size_t&gt;)`, 
&gt; 
&gt; and `Pasteboard::read(PasteboardWebContentReader&amp; reader,
&gt; WebContentReadingPolicy policy, std::optional&lt;size_t&gt;)` got no chances, so
&gt; the image data dit not got read.
&gt; 
&gt; this patch is a workaround to fixup the problem (tested under webkitgtk
&gt; 2.32.0 and 2.32.1).
&gt; 
&gt; by patching `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; std::optional&lt;size_t&gt;)`,  and call
&gt; `WebCorePasteboardFileReader::readBuffer`, we can make
&gt; `DataTransferItem::getAsFile()` get the image file data.

Thanks. I applied the patch you linked (https://bugs.webkit.org/attachment.cgi?id=433288&amp;action=diff) against webkitgtk 2.32.2 and the compiled it and then compiled Epiphany 40.2 against that webkitgtk build but pasting image data from the clipboard still does not work for me.

Is this https://bugs.webkit.org/attachment.cgi?id=433288&amp;action=diff enough or should I apply something else too? Waht do you mean with this: &quot;by patching `void Pasteboard::read(PasteboardFileReader&amp; reader, std::optional&lt;size_t&gt;)`,  and call `WebCorePasteboardFileReader::readBuffer`, we can make `DataTransferItem::getAsFile()` get the image file data.&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1776305</commentid>
    <comment_count>23</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-07-12 06:30:08 -0700</bug_when>
    <thetext>(In reply to Miikka from comment #22)
&gt; (In reply to 荒野無燈 from comment #18)
&gt; &gt; Created attachment 433288 [details]
&gt; &gt; fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get
&gt; &gt; no files, this fix makes ctrl + v paste image under GTK  works
&gt; &gt; 
&gt; &gt; in Source/WebCore/dom/DataTransfer.cpp 
&gt; &gt; DataTransfer::filesFromPasteboardAndItemList
&gt; &gt; 
&gt; &gt; ```cpp
&gt; &gt;  WebCorePasteboardFileReader reader(context);
&gt; &gt;  m_pasteboard-&gt;read(reader);
&gt; &gt;  files = WTFMove(reader.files);
&gt; &gt; ```
&gt; &gt; 
&gt; &gt; it only calls `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; &gt; std::optional&lt;size_t&gt;)`, 
&gt; &gt; 
&gt; &gt; and `Pasteboard::read(PasteboardWebContentReader&amp; reader,
&gt; &gt; WebContentReadingPolicy policy, std::optional&lt;size_t&gt;)` got no chances, so
&gt; &gt; the image data dit not got read.
&gt; &gt; 
&gt; &gt; this patch is a workaround to fixup the problem (tested under webkitgtk
&gt; &gt; 2.32.0 and 2.32.1).
&gt; &gt; 
&gt; &gt; by patching `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; &gt; std::optional&lt;size_t&gt;)`,  and call
&gt; &gt; `WebCorePasteboardFileReader::readBuffer`, we can make
&gt; &gt; `DataTransferItem::getAsFile()` get the image file data.
&gt; 
&gt; Thanks. I applied the patch you linked
&gt; (https://bugs.webkit.org/attachment.cgi?id=433288&amp;action=diff) against
&gt; webkitgtk 2.32.2 and the compiled it and then compiled Epiphany 40.2 against
&gt; that webkitgtk build but pasting image data from the clipboard still does
&gt; not work for me.
&gt; 
&gt; Is this https://bugs.webkit.org/attachment.cgi?id=433288&amp;action=diff enough
&gt; or should I apply something else too? Waht do you mean with this: &quot;by
&gt; patching `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; std::optional&lt;size_t&gt;)`,  and call
&gt; `WebCorePasteboardFileReader::readBuffer`, we can make
&gt; `DataTransferItem::getAsFile()` get the image file data.&quot;?

just use this patch will works fine.

please note that this patch does not related to GNOME Web browser Epiphany.

I compared from webkitgtk-2.32.0 to webkitgtk-2.32.2, the `Source/WebCore/platform/gtk/PasteboardGtk.cpp` file are all the same, 
I tested the patch under webkitgtk 2.32.0 and 2.32.1, so I do think it should works for 2.32.2

by the way, I use this page (thanks Sonny Piers) to test: https://codepen.io/tmrDevelops/pen/YxGQaW

and I also tested it under Epiphany 40.1 on Ubuntu 21.04 (https://i.ibb.co/FXhhSYZ/Epiphany-40-1-on-Ubuntu-21-042021-07-12-21-07.png), and Epiphany Technology Preview 41.alpha-4-g70730e4dd+ does not work. but I recommend you not to verify the patch via Epiphany browser, this will introduce more variable.

Using a simple code (in your favorite lang) to create a webview, then loading the page: https://codepen.io/tmrDevelops/pen/YxGQaW and then see if it works.

In my situation, I use the WebKitGtk lib via https://github.com/gtk-rs/webkit2gtk-rs

hope this will help you.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1797859</commentid>
    <comment_count>24</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-09-28 06:12:57 -0700</bug_when>
    <thetext>*** Bug 211519 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1824051</commentid>
    <comment_count>25</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-12-14 10:50:09 -0800</bug_when>
    <thetext>(In reply to 荒野無燈 from comment #23)
&gt; (In reply to Miikka from comment #22)
&gt; &gt; (In reply to 荒野無燈 from comment #18)
&gt; &gt; &gt; Created attachment 433288 [details]
&gt; &gt; &gt; fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get
&gt; &gt; &gt; no files, this fix makes ctrl + v paste image under GTK  works
&gt; &gt; &gt; 
&gt; &gt; &gt; in Source/WebCore/dom/DataTransfer.cpp 
&gt; &gt; &gt; DataTransfer::filesFromPasteboardAndItemList
&gt; &gt; &gt; 
&gt; &gt; &gt; ```cpp
&gt; &gt; &gt;  WebCorePasteboardFileReader reader(context);
&gt; &gt; &gt;  m_pasteboard-&gt;read(reader);
&gt; &gt; &gt;  files = WTFMove(reader.files);
&gt; &gt; &gt; ```
&gt; &gt; &gt; 
&gt; &gt; &gt; it only calls `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; &gt; &gt; std::optional&lt;size_t&gt;)`, 
&gt; &gt; &gt; 
&gt; &gt; &gt; and `Pasteboard::read(PasteboardWebContentReader&amp; reader,
&gt; &gt; &gt; WebContentReadingPolicy policy, std::optional&lt;size_t&gt;)` got no chances, so
&gt; &gt; &gt; the image data dit not got read.
&gt; &gt; &gt; 
&gt; &gt; &gt; this patch is a workaround to fixup the problem (tested under webkitgtk
&gt; &gt; &gt; 2.32.0 and 2.32.1).
&gt; &gt; &gt; 
&gt; &gt; &gt; by patching `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; &gt; &gt; std::optional&lt;size_t&gt;)`,  and call
&gt; &gt; &gt; `WebCorePasteboardFileReader::readBuffer`, we can make
&gt; &gt; &gt; `DataTransferItem::getAsFile()` get the image file data.
&gt; &gt; 
&gt; &gt; Thanks. I applied the patch you linked
&gt; &gt; (https://bugs.webkit.org/attachment.cgi?id=433288&amp;action=diff) against
&gt; &gt; webkitgtk 2.32.2 and the compiled it and then compiled Epiphany 40.2 against
&gt; &gt; that webkitgtk build but pasting image data from the clipboard still does
&gt; &gt; not work for me.
&gt; &gt; 
&gt; &gt; Is this https://bugs.webkit.org/attachment.cgi?id=433288&amp;action=diff enough
&gt; &gt; or should I apply something else too? Waht do you mean with this: &quot;by
&gt; &gt; patching `void Pasteboard::read(PasteboardFileReader&amp; reader,
&gt; &gt; std::optional&lt;size_t&gt;)`,  and call
&gt; &gt; `WebCorePasteboardFileReader::readBuffer`, we can make
&gt; &gt; `DataTransferItem::getAsFile()` get the image file data.&quot;?
&gt; 
&gt; just use this patch will works fine.
&gt; 
&gt; please note that this patch does not related to GNOME Web browser Epiphany.
&gt; 
&gt; I compared from webkitgtk-2.32.0 to webkitgtk-2.32.2, the
&gt; `Source/WebCore/platform/gtk/PasteboardGtk.cpp` file are all the same, 
&gt; I tested the patch under webkitgtk 2.32.0 and 2.32.1, so I do think it
&gt; should works for 2.32.2
&gt; 
&gt; by the way, I use this page (thanks Sonny Piers) to test:
&gt; https://codepen.io/tmrDevelops/pen/YxGQaW
&gt; 
&gt; and I also tested it under Epiphany 40.1 on Ubuntu 21.04
&gt; (https://i.ibb.co/FXhhSYZ/Epiphany-40-1-on-Ubuntu-21-042021-07-12-21-07.png),
&gt; and Epiphany Technology Preview 41.alpha-4-g70730e4dd+ does not work. but I
&gt; recommend you not to verify the patch via Epiphany browser, this will
&gt; introduce more variable.
&gt; 
&gt; Using a simple code (in your favorite lang) to create a webview, then
&gt; loading the page: https://codepen.io/tmrDevelops/pen/YxGQaW and then see if
&gt; it works.
&gt; 
&gt; In my situation, I use the WebKitGtk lib via
&gt; https://github.com/gtk-rs/webkit2gtk-rs
&gt; 
&gt; hope this will help you.

Yes, I tested this by using the WebKit4GTK MiniBrowser now (/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/MiniBrowser) and the image data pasting works there (both in normal and in editor mode: --editor-mode). But in other WebKit based browsers, like Epiphany it still does not work :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1824205</commentid>
    <comment_count>26</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-12-14 18:14:22 -0800</bug_when>
    <thetext>(In reply to Miikka from comment #25)
&gt; (In reply to 荒野無燈 from comment #23)
&gt; &gt; (In reply to Miikka from comment #22)
&gt; 
&gt; Yes, I tested this by using the WebKit4GTK MiniBrowser now
&gt; (/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/MiniBrowser) and the image data
&gt; pasting works there (both in normal and in editor mode: --editor-mode). But
&gt; in other WebKit based browsers, like Epiphany it still does not work :(

I have binary build for ArchLinux ( if you are using),

I use it for my everyday work. it is here: https://github.com/ttys3/archlinux-webkit2gtk/releases/tag/v2.34.2-1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1824268</commentid>
    <comment_count>27</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-12-15 00:20:17 -0800</bug_when>
    <thetext>(In reply to 荒野無燈 from comment #26)
&gt; I use it for my everyday work. it is here:
&gt; https://github.com/ttys3/archlinux-webkit2gtk/releases/tag/v2.34.2-1

Thanks. I assume you&apos;re using this with webkit2gtk-rs where your patch is working, right? But does it work with Gnome Epiphany or other modern/GUI WebKitGTK browser? Have you tested?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1824279</commentid>
    <comment_count>28</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2021-12-15 01:20:26 -0800</bug_when>
    <thetext>(In reply to Miikka from comment #27)
&gt; (In reply to 荒野無燈 from comment #26)
&gt; &gt; I use it for my everyday work. it is here:
&gt; &gt; https://github.com/ttys3/archlinux-webkit2gtk/releases/tag/v2.34.2-1
&gt; 
&gt; Thanks. I assume you&apos;re using this with webkit2gtk-rs where your patch is
&gt; working, right? But does it work with Gnome Epiphany or other modern/GUI
&gt; WebKitGTK browser? Have you tested?

No. you are totally wrong. I tested with all, works like a charm.

including Web 41.0 (Powered by WebKitGTK 2.34.2), yes it is what your ref &quot;Gnome Epiphany&quot;

Michael Catanzaro  also confirmed that this patch will work.

The problem is not it work or not work.

It is because this patch is fixing the issue in way which maybe not elegant enough.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1827218</commentid>
    <comment_count>29</comment_count>
    <who name="Miikka">miikka.veijonen</who>
    <bug_when>2021-12-30 00:26:17 -0800</bug_when>
    <thetext>(In reply to 荒野無燈 from comment #28)
&gt; 
&gt; No. you are totally wrong. I tested with all, works like a charm.
&gt; 
&gt; including Web 41.0 (Powered by WebKitGTK 2.34.2), yes it is what your ref
&gt; &quot;Gnome Epiphany&quot;
&gt; 
&gt; Michael Catanzaro  also confirmed that this patch will work.
&gt; 
&gt; The problem is not it work or not work.
&gt; 
&gt; It is because this patch is fixing the issue in way which maybe not elegant
&gt; enough.

Yes, you were right! I had some time now to test and verify this by compiling the WebKitGTK v2.34.3 (with your patches included: https://github.com/ttys3/archlinux-webkit2gtk/tree/main/gtk4.0) and Gnome Web (Epiphany web browser) v3.38.4 on my Debian 11 box and the pasting of images (like PNGs and JPEGs) works now on Gnome Web browser as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1950413</commentid>
    <comment_count>30</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2023-04-21 10:29:39 -0700</bug_when>
    <thetext>*** Bug 255505 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2114476</commentid>
    <comment_count>31</comment_count>
    <who name="Peter Bittner">peter.bittner</who>
    <bug_when>2025-05-01 12:48:38 -0700</bug_when>
    <thetext>I&apos;m confused: I found and reported this bug today on GNOME&apos;s issue tracker, for GNOME Web 47.3.1 (WebKitGTK 2.48.1, Streamer 1.26.0, GTK 4.16.12, Libadwaita 1.6.4).

The latest comments by 荒野無燈 and Miikka from mid december 2021, roughly 3½ years ago, claim that a fix for the bug was successfully tested with GNOME Web 41.0 (WebKitGTK 2.34.2). Why is the bug still present in GNOME Web today?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2114496</commentid>
    <comment_count>32</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-05-01 13:54:24 -0700</bug_when>
    <thetext>I rejected the proposed fix in comment #20. Somebody just needs to look at this a bit closer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2114497</commentid>
    <comment_count>33</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-05-01 14:05:35 -0700</bug_when>
    <thetext>My rejection reason isn&apos;t even correct, since readFilePathsFromClipboard is not actually modified at all. The patch only touches one of the Pasteboard::read implementations, the one handling file data.

So this was actually on the right track, but instead of handling only hardcoded image types, it looks like we should do something similar to the PasteboardCocoa.mm implementation of Pasteboard::read, the one with the PasteboardFileReader parameter. Instead of processing a hardcoded list of MIME types, we should call PasteboardFileReader::shouldReadBuffer to decide if the MIME type we&apos;ve received is supported, and if so then we can call Pasteboard::readBuffer.

Currently the code does this:

    if (reader.shouldReadBuffer(&quot;image/png&quot;_s)) {
        if (auto buffer = readBuffer(index, &quot;image/png&quot;_s))
            reader.readBuffer({ }, { }, buffer.releaseNonNull());
    }

which should be deleted (from both PasteboardGTK.cpp and PasteboardWPE.cpp). Coincidentally, I asked about this last week in https://github.com/WebKit/WebKit/pull/44409#discussion_r2058824633. It was added after this patch was submitted and it&apos;s basically a worse version of what this patch was proposing to do, supporting only one MIME type instead of several.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115929</commentid>
    <comment_count>34</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-05-08 12:01:56 -0700</bug_when>
    <thetext>I spent some time on this today and am attaching an updated patch, but I&apos;m not submitting it as a pull request because I&apos;m unable to reproduce the original problem so I don&apos;t actually understand what I&apos;m &quot;fixing.&quot; I can paste PNG and JPEG images into every web page I&apos;ve tested that accepts images: gitlab.gnome.org, docs.google.com, and even Miikka&apos;s test page https://codepen.io/tmrDevelops/pen/YxGQaW. I&apos;m not too surprised, because the Pasteboard::read overload that takes a PasteboardWebContentReader did not require any changes. But I also tried pasting file URIs from nautilus, and even then, JPEG images get pasted just fine... I would have expected only PNG to work. So I assume this was mostly fixed sometime in the past few years.

Hi Peter, since you commented here most recently: any chance you have a test page I can use to reproduce the problem you&apos;re encountering? Ideally one that does not require logging into a user account.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115930</commentid>
    <comment_count>35</comment_count>
      <attachid>475171</attachid>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-05-08 12:02:47 -0700</bug_when>
    <thetext>Created attachment 475171
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115935</commentid>
    <comment_count>36</comment_count>
    <who name="Peter Bittner">peter.bittner</who>
    <bug_when>2025-05-08 12:34:08 -0700</bug_when>
    <thetext>Michael, my test page is bug report on GNOME&apos;s GitLab instance. https://gitlab.gnome.org/GNOME/epiphany/-/issues/2660#note_2435144

You commented there that you can paste an image when the rich editor mode is active. The image will be visible after being pasted, it doesn&apos;t get uploaded, though. Consequently, it won&apos;t be saved. Hence, the JavaScript-powered rich text editor has the same problem as the plain text editor.

You can verify this behavior on any GitLab instance, including Gitlab.com. With Firefox and Chromium browsers images pasted from the clipboard will be uploaded, whether you use the plain text or rich text editor mode. With GNOME Web (on my NixOS box) this will consistently not work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115938</commentid>
    <comment_count>37</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-05-08 12:47:00 -0700</bug_when>
    <thetext>I think paste is working properly and you&apos;re hitting some other bug. Feel free to create a new bug report (here on WebKit Bugzilla) for this problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2116049</commentid>
    <comment_count>38</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2025-05-08 21:14:08 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #34)
&gt; I spent some time on this today and am attaching an updated patch, but I&apos;m
&gt; not submitting it as a pull request because I&apos;m unable to reproduce the
&gt; original problem so I don&apos;t actually understand what I&apos;m &quot;fixing.&quot; I can
&gt; paste PNG and JPEG images into every web page I&apos;ve tested that accepts
&gt; images: gitlab.gnome.org, docs.google.com, and even Miikka&apos;s test page
&gt; https://codepen.io/tmrDevelops/pen/YxGQaW. I&apos;m not too surprised, because
&gt; the Pasteboard::read overload that takes a PasteboardWebContentReader did
&gt; not require any changes. But I also tried pasting file URIs from nautilus,
&gt; and even then, JPEG images get pasted just fine... I would have expected
&gt; only PNG to work. So I assume this was mostly fixed sometime in the past few
&gt; years.
&gt; 
&gt; Hi Peter, since you commented here most recently: any chance you have a test
&gt; page I can use to reproduce the problem you&apos;re encountering? Ideally one
&gt; that does not require logging into a user account.

you can reproduce via Miikka&apos;s test page https://codepen.io/tmrDevelops/pen/YxGQaW , if you do screenshot and try paste things to the page.


copy from GNOME file manager and the paste will work, because it is `file:///` .  but for image data in the clipboard, it is image data.

for example, install flameshot (https://github.com/flameshot-org/flameshot) and use hot key to do screenshot (then the image will in clipboard). then try to paste the screenshot to Miikka&apos;s test page. you will see nothing got pasted.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2116051</commentid>
    <comment_count>39</comment_count>
    <who name="荒野無燈">ttys3.rust</who>
    <bug_when>2025-05-08 21:25:48 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #34)
&gt; I spent some time on this today and am attaching an updated patch, but I&apos;m
&gt; not submitting it as a pull request because I&apos;m unable to reproduce the
&gt; original problem so I don&apos;t actually understand what I&apos;m &quot;fixing.&quot; I can
&gt; paste PNG and JPEG images into every web page I&apos;ve tested that accepts
&gt; images: gitlab.gnome.org, docs.google.com, and even Miikka&apos;s test page
&gt; https://codepen.io/tmrDevelops/pen/YxGQaW. I&apos;m not too surprised, because
&gt; the Pasteboard::read overload that takes a PasteboardWebContentReader did
&gt; not require any changes. But I also tried pasting file URIs from nautilus,
&gt; and even then, JPEG images get pasted just fine... I would have expected
&gt; only PNG to work. So I assume this was mostly fixed sometime in the past few
&gt; years.
&gt; 
&gt; Hi Peter, since you commented here most recently: any chance you have a test
&gt; page I can use to reproduce the problem you&apos;re encountering? Ideally one
&gt; that does not require logging into a user account.

and Michael,  At the same time, I would like to point out that this bug only exists in the older way of clipboard reading images. For code using the newer Async Clipboard API （https://webkit.org/blog/10855/async-clipboard-api/）, webkitgtk does not have this bug.

I have a demo here https://codepen.io/ttys3/pen/gbbdzdb, you can see that pasting images works well with the existing GNOME Web (Epiphany browser).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2150044</commentid>
    <comment_count>40</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-10-10 12:50:18 -0700</bug_when>
    <thetext>OK, thanks to Mikka&apos;s patch, Sonny&apos;s codepen, and critical guidance from 荒野無燈, I was able to find a solution. Thanks to you all for helping. Sorry it took 5 years, but better late than never. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2150046</commentid>
    <comment_count>41</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2025-10-10 13:01:42 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/52136</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2152965</commentid>
    <comment_count>42</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-10-21 06:36:35 -0700</bug_when>
    <thetext>Committed 301877@main (d7d1107bc9b6): &lt;https://commits.webkit.org/301877@main&gt;

Reviewed commits have been landed. Closing PR #52136 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2152966</commentid>
    <comment_count>43</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-10-21 06:37:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/163112783&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>433288</attachid>
            <date>2021-07-11 06:33:22 -0700</date>
            <delta_ts>2021-07-12 07:39:35 -0700</delta_ts>
            <desc>fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get no files, this fix makes ctrl + v paste image under GTK  works</desc>
            <filename>PasteboardGtk.patch</filename>
            <type>text/plain</type>
            <size>1604</size>
            <attacher name="荒野無燈">ttys3.rust</attacher>
            
              <data encoding="base64">Y29tbWl0IDNmOGVhZjc0ZmU5ODkwNGVkN2QzMzA1YTA2YTc2NDdlODI0ZTE3NjEKQXV0aG9yOiDo
jZLph47nhKHnh4ggPHR0eXMzLnJ1c3RAZ21haWwuY29tPgpEYXRlOiAgIFN1biBKdWwgMTEgMjE6
MTU6NTggMjAyMSArMDgwMAoKICAgIGZpeDogZmFsbGJhY2sgdG8gcmVhZEJ1ZmZlckZyb21DbGlw
Ym9hcmQgaWYgcmVhZEZpbGVQYXRoc0Zyb21DbGlwYm9hcmQgZ2V0IG5vIGZpbGVzLCB0aGlzIGZp
eCBtYWtlcyBjdHJsICsgdiBwYXN0ZSBpbWFnZSB1bmRlciBHVEsgd29ya3MKICAgIAogICAgUmVm
czogaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTIxODUxOQoKZGlmZiAt
LWdpdCBhL1NvdXJjZS9XZWJDb3JlL3BsYXRmb3Jt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XRvJiBpbWFnZVR5cGUgOiBpbWFnZVR5cGVzKSB7Cisg
ICAgICAgICAgICBpZiAodHlwZXMuY29udGFpbnMoaW1hZ2VUeXBlKSkgeworICAgICAgICAgICAg
ICAgIGF1dG8gYnVmZmVyID0gcGxhdGZvcm1TdHJhdGVnaWVzKCktPnBhc3RlYm9hcmRTdHJhdGVn
eSgpLT5yZWFkQnVmZmVyRnJvbUNsaXBib2FyZChtX25hbWUsIGltYWdlVHlwZSk7CisgICAgICAg
ICAgICAgICAgaWYgKCFidWZmZXItPmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICBy
ZWFkZXIucmVhZEJ1ZmZlcihpbWFnZVR5cGUsIGltYWdlVHlwZSwgYnVmZmVyLnJlbGVhc2VOb25O
dWxsKCkpOworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQor
ICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQogfQogCiBib29sIFBhc3RlYm9hcmQ6Omhh
c0RhdGEoKQo=
</data>
<flag name="review"
          id="455514"
          type_id="1"
          status="-"
          setter="mcatanzaro"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>475171</attachid>
            <date>2025-05-08 12:02:47 -0700</date>
            <delta_ts>2025-05-08 12:02:47 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <size>6264</size>
            <attacher name="Michael Catanzaro">mcatanzaro</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL3BsYXRmb3JtL1Bhc3RlYm9hcmQuY3BwIGIvU291
cmNlL1dlYkNvcmUvcGxhdGZvcm0vUGFzdGVib2FyZC5jcHAKaW5kZXggYzNlZGI1YmMxYjY5Li4w
NTI3MWVkMTAyZTcgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJDb3JlL3BsYXRmb3JtL1Bhc3RlYm9h
cmQuY3Bw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yAgICAgICAg
ICAgIGlmIChidWZmZXIpIHsKKyAgICAgICAgICAgICAgICByZWFkZXIucmVhZEJ1ZmZlcihpbWFn
ZVR5cGVUb0Zha2VGaWxlbmFtZShpbWFnZVR5cGUpLCBpbWFnZVR5cGUsIGJ1ZmZlci5yZWxlYXNl
Tm9uTnVsbCgpKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAg
ICAgfQorICAgIH07CisKKyAgICBpZiAoaW5kZXgpIHsKKyAgICAgICAgcmVhZEJ1ZmZlckF0SW5k
ZXgoKmluZGV4KTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmIChhdXRvIGFsbElu
Zm8gPSBhbGxQYXN0ZWJvYXJkSXRlbUluZm8oKSkgeworICAgICAgICBmb3IgKHNpemVfdCBpdGVt
SW5kZXggPSAwOyBpdGVtSW5kZXggPCBhbGxJbmZvLT5zaXplKCk7ICsraXRlbUluZGV4KQorICAg
ICAgICAgICAgcmVhZEJ1ZmZlckF0SW5kZXgoaXRlbUluZGV4KTsKICAgICB9CiB9CiAK
</data>

          </attachment>
      

    </bug>

</bugzilla>