Giter Club home page Giter Club logo

Comments (4)

clonemeagain avatar clonemeagain commented on June 11, 2024

Hmm.. You're trying to match HTML with regular expressions.

image

https://stackoverflow.com/a/1732454/276663

Having said that, people do it all the time. I notice you aren't matching the < & > of the "table" tags. Which might cause some corruption in the output.. but without some source to play with, I can't really be sure.

Also of note, the plugin uses text from the MessageBody object: (string) $val->body etc.. which may or may not be after osTicket runs this:

        // Capture a list of inline images
        $images_before = $images_after = array();
        preg_match_all('/src=("|\'|\b)cid:(\S+)\1/', $this->body, $images_before,
            PREG_PATTERN_ORDER);

So, it's possible that the image has been replaced with a cid inline-attachment code.. (Looks like mailfetch & mailparse both call that

If you're comfortable forwarding me an email that is failing to match, I'll have a look. [email protected] Or, and this might be the ticket, find a ticket with that attached image, and see what cid code it get's, then match that! ;-)

from plugin-fwd-rewriter.

AdamDempsey avatar AdamDempsey commented on June 11, 2024

The images are hosted so they weren't effected by that, turns out my regex skills were just a bit rusty and when I was testing the email body was a single line, I needed to add the s (PCRE_DOTALL) modifier then it worked.

It's now picking up too much but that's a regex issue (your image is right, already regretting starting this! ha) but plugin itself working perfectly so thanks :)

Edit: Actually the problem wasn't my regex but because it was using a colon which is your separator between $pattern and $replacement, so I just updated both class.RewriterPlugin.php and config.php to use another separator character now all is working for me, thanks again :)

from plugin-fwd-rewriter.

clonemeagain avatar clonemeagain commented on June 11, 2024

Oh cool, what separator worked? Or just make a pull with the change mate.

from plugin-fwd-rewriter.

AdamDempsey avatar AdamDempsey commented on June 11, 2024

I'm using the pipe character although just looked it up and that is also reserved in regex so still needs to be something else.

from plugin-fwd-rewriter.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.