Skip to content

use an explicit 'mimetype' argument for getclipboard #11632

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

Closed
wants to merge 33 commits into from

Conversation

caolanm
Copy link
Contributor

@caolanm caolanm commented Apr 14, 2025

Change-Id: I6e985983b1caf955864ff0dfe8af1fd2f35b79b7

  • Resolves: #
  • Target version: master

Summary

TODO

  • ...

Checklist

  • I have run make prettier-write and formatted the code.
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

@caolanm caolanm marked this pull request as draft April 15, 2025 13:13
@caolanm caolanm force-pushed the private/caolan/clipboard_argument branch from ebb4634 to 8a86e52 Compare April 29, 2025 15:48
@@ -1563,8 +1572,8 @@
std::vector<char> output;
output.reserve(outGuess);

// FIXME: extra 'content' is necessary for Message parsing.
Util::vectorAppend(output, "clipboardcontent: content\n");
//// FIXME: extra 'content' is necessary for Message parsing.

Check notice

Code scanning / CodeQL

FIXME comment Note

FIXME comment: extra 'content' is necessary for Message parsing.

Copilot Autofix

AI about 1 month ago

To address the issue, we need to ensure that the extra 'content' is included in the output when building the clipboard content. This involves uncommenting the line Util::vectorAppend(output, "clipboardcontent: content\n"); and ensuring it is placed correctly in the code. The fix should maintain the existing functionality while resolving the issue described in the FIXME comment.

Steps to fix:

  1. Uncomment the line Util::vectorAppend(output, "clipboardcontent: content\n");.
  2. Place it before the loop that processes outCount items, as it seems to be a preparatory step for message parsing.
  3. Remove the FIXME comment, as the issue will be resolved.

Suggested changeset 1
kit/ChildSession.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1575,4 +1575,3 @@
 
-    //// FIXME: extra 'content' is necessary for Message parsing.
-    //Util::vectorAppend(output, "clipboardcontent: content\n");
+    Util::vectorAppend(output, "clipboardcontent: content\n");
     bool json = !specifics.empty();
EOF
@@ -1575,4 +1575,3 @@

//// FIXME: extra 'content' is necessary for Message parsing.
//Util::vectorAppend(output, "clipboardcontent: content\n");
Util::vectorAppend(output, "clipboardcontent: content\n");
bool json = !specifics.empty();
Copilot is powered by AI and may make mistakes. Always verify output.
LOG_TRC("Sending clipboardcontent of size " << output.size() << " bytes");
sendBinaryFrame(output.data(), output.size());
// sendBinaryFrame(output.data(), output.size());

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 1 month ago

To fix the issue, we need to either remove the commented-out code or reinstate it if it is still relevant. Since the context does not indicate that the commented-out code is actively used or necessary, the best course of action is to remove it. This will improve code clarity and maintainability. If the functionality is required in the future, it can be reintroduced with proper testing and documentation.

Suggested changeset 1
kit/ChildSession.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1632,3 +1632,3 @@
     LOG_TRC("Sending clipboardcontent of size " << output.size() << " bytes");
-    // sendBinaryFrame(output.data(), output.size());
+// (Line removed as it contained commented-out code that was not in use)
 
EOF
@@ -1632,3 +1632,3 @@
LOG_TRC("Sending clipboardcontent of size " << output.size() << " bytes");
// sendBinaryFrame(output.data(), output.size());
// (Line removed as it contained commented-out code that was not in use)

Copilot is powered by AI and may make mistakes. Always verify output.
caolanm added 25 commits May 1, 2025 16:57
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6e985983b1caf955864ff0dfe8af1fd2f35b79b7
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id136c9e1972d438171a0fa49d653173ad51cf562
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic30f30167e2bdbd7de7d943f963278719978908d
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5e2e797870d559a362b8642b40fce7d063116125
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3421b17c9e1ed59726e5e2b5c16137846e14c60f
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibd3947d3fff28dcc1e50a76e1d19daafca3061bf
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3c1ec9782b255f2d02840903610fefb27e71f6fc
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie83344607c8c8eb63f6826a3e2a38016a1346476
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5b8453fddb102ce5762fa82397158dd3eed3da36
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0f6c5bbe5fbf7b4f86f4a388b77e09868b695980
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0391a05267cc1e0f29e4a17701ff661aef945815
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If7be4ef1283e581bcd04a9be36634750bb4f6a73
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iab6773b56335869f53265292824bb8abc15d95be
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I01164e5139e3c6d67ae5f7a53caf6caee937d94a
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I09751326ca75be47e738d3ff4db950dfa7f6b17a
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3dad2652a9c8dc346bf3bf465e3c6c2ad23c5450
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I35d6e7f28c4103eb9b14f1a470c6153b2a0241df
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iad451816b424af1ff24d49527720085bf0ac30ae
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ied6e71b1d2a9cc4533c982f029a8422655b033a4
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib098dc4755b4c1464f516d67d78e3a5733764207
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibebe40260d95eb20c1a0efe13478bd2707fea492
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I61cee5fcbcbbae4595ddcefb970e344ed5ee3bce
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0a32478b74576fcb11a42d7bcf5eebfcf5698409
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I14291b443d57ca2bada3d55d991b4cc9fd30c5fd
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I419b208478ed84193fa81da49f8fddb8c01b0e57
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5182f7c95750244f0b6af2241b80e7e6bfc61324
@caolanm caolanm force-pushed the private/caolan/clipboard_argument branch from 8a86e52 to 57038cf Compare May 1, 2025 16:16
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ief7a168b7f0e3a709a6117bdf1ea172974b13883
_postFileDir = FileUtil::createRandomTmpDir(COOLWSD::ChildRoot +
JailUtil::CHILDROOT_TMP_INCOMING_PATH) + '/';
std::string postFilename = _postFileDir + "poststream";
_postStream.open(postFilename.c_str());

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This argument to a file access function is derived from
user input (an environment variable)
and then passed to std::basic_fstream<char, char_traits>::open(__s), which calls std::basic_filebuf<char, char_traits>::open(__s).
This argument to a file access function is derived from
user input (an environment variable)
and then passed to std::basic_fstream<char, char_traits>::open(__s).
This argument to a file access function is derived from
user input (an environment variable)
and then passed to std::basic_fstream<char, char_traits>::open(__s), which calls std::basic_filebuf<char, char_traits>::open(__s).
This argument to a file access function is derived from
user input (an environment variable)
and then passed to std::basic_fstream<char, char_traits>::open(__s).
This argument to a file access function is derived from
user input (an environment variable)
and then passed to std::basic_fstream<char, char_traits>::open(__s), which calls std::basic_filebuf<char, char_traits>::open(__s).
This argument to a file access function is derived from
user input (an environment variable)
and then passed to std::basic_fstream<char, char_traits>::open(__s).

Copilot Autofix

AI about 1 month ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

RequestDetails requestDetails(request, COOLWSD::ServiceRoot);
// LOG_TRC("Request details " << requestDetails.toString());

//fprintf(stderr, "size of message is %ld for %s\n", socket->getInBuffer().size(), requestDetails.toString().c_str());

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 1 month ago

To fix the issue, we should either remove the commented-out fprintf statement entirely or reinstate it if it is still relevant. Since there is no indication that this code is actively used or needed, the best course of action is to remove it. This will clean up the code and eliminate any potential confusion for future developers.


Suggested changeset 1
wsd/ClientRequestDispatcher.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/wsd/ClientRequestDispatcher.cpp b/wsd/ClientRequestDispatcher.cpp
--- a/wsd/ClientRequestDispatcher.cpp
+++ b/wsd/ClientRequestDispatcher.cpp
@@ -896,4 +896,2 @@
 
-        //fprintf(stderr, "size of message is %ld for %s\n", socket->getInBuffer().size(), requestDetails.toString().c_str());
-
         // Config & security ...
EOF
@@ -896,4 +896,2 @@

//fprintf(stderr, "size of message is %ld for %s\n", socket->getInBuffer().size(), requestDetails.toString().c_str());

// Config & security ...
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
caolanm added 5 commits May 1, 2025 17:37
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3b9243c8fae5de5f36563a46561194c04ed4d41c
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0f5f2c3fd9439cb5a2ba5c8b26ef32b5adc3b795
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6306fc48f266327e952466fe0c82ae2a8de47308
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia252d931c8c468275b7a52817dffe920e625b0cc
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibf0d314d322aab676f3bedca36e72d38142095d9
}
~ClipFile()
{
// FileUtil::removeFile(_file);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 1 month ago

To address the issue, we need to either remove the commented-out code or reinstate it. Since the code appears in a destructor, it is likely intended to clean up resources (e.g., removing a file). If this functionality is still required, the line should be reinstated. Otherwise, it should be removed entirely to avoid confusion. For this fix, we will reinstate the line, assuming that the cleanup operation is necessary.


Suggested changeset 1
common/Clipboard.hpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/common/Clipboard.hpp b/common/Clipboard.hpp
--- a/common/Clipboard.hpp
+++ b/common/Clipboard.hpp
@@ -136,3 +136,3 @@
         {
-            // FileUtil::removeFile(_file);
+            FileUtil::removeFile(_file);
         }
EOF
@@ -136,3 +136,3 @@
{
// FileUtil::removeFile(_file);
FileUtil::removeFile(_file);
}
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
~RemoveClipFile()
{
fprintf(stderr, "remove clip %s\n", _clipFile.c_str());
// FileUtil::removeFile(_clipFile);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 1 month ago

The best way to fix this issue is to either remove the commented-out code entirely or reinstate it if it is still relevant and necessary. If the functionality of FileUtil::removeFile is required, the line should be uncommented and tested to ensure it works as intended. If the line is no longer needed, it should be deleted to avoid confusion and maintain code clarity.

In this case, since there is no indication that the commented-out code is required, the most appropriate fix is to remove it.


Suggested changeset 1
wsd/ClientSession.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -2201,3 +2201,2 @@
             fprintf(stderr, "remove clip %s\n", _clipFile.c_str());
-            // FileUtil::removeFile(_clipFile);
         }
EOF
@@ -2201,3 +2201,2 @@
fprintf(stderr, "remove clip %s\n", _clipFile.c_str());
// FileUtil::removeFile(_clipFile);
}
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9f1336859f725cba8650b71860f1923a55860bf4
@caolanm caolanm closed this May 8, 2025
@github-project-automation github-project-automation bot moved this from To Review to Done in Collabora Online May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant