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

hack to handle incoming files which come as an absolute path #255

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

dexterlb
Copy link
Contributor

Just to be clear: This pull request proposes a nasty workaround. If someone could point the root cause so that this can be properly fixed, it would be much better.

Current behaviour:
when receiving a file through the libpurple backend from a service which uses cloud storage (such as telegram, skypeweb etc), conv_write_im gets passed a message which looks like this:

[document <a href="file:////var/lib/spectrum2/telegram.my.domain/telegram-purple/+88888888888/downloads/download_5913692237379666901.bin">file_name.txt</a> text/plain 38 bytes]

And so, the message is sent to the user, resulting in them seeing a raw filesystem path on the server (ugh!)

Workaround:
This seems to be happening somewhere in libpurple. Since I'm (so far) unable to locate it, I'm proposing this workaround, which matches those messages, moves the respectful file to the web storage (if enabled), and modifies the message to include a proper link.

@vitalyster
Copy link
Collaborator

vitalyster commented Jul 12, 2018

Sorry for delay, finally found time to set up telegram, the root problem is there - https://github.com/majn/telegram-purple/blob/master/tgp-msg.c#L209

Copy link
Contributor

@stv0g stv0g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know a better approach either :(

boost::filesystem::path(target_file)
);

plain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove newline

xhtml_ = xhtml;
g_free(xhtml);
g_free(strip);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a line break:

}
else {

g_free(xhtml);
g_free(strip);
} else {
// Escape HTML characters.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section is not properly indented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants