Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-45322

Portfolio export of embedded images wrapped in a link

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.6.2
    • Fix Version/s: BACKEND
    • Component/s: Portfolio
    • Labels:
    • Affected Branches:
      MOODLE_26_STABLE

      Description

      When exporting a content that contains an image, which is wrapped in a link pointing to itself, or another embedded file, either:

      • the image is removed or;
      • the link disappears.

              // Test with img in a link pointing to another file.
              $input = '<p><a href="@@PLUGINFILE@@' . $filepath . $filenamepdf . '">' .
                  '<img src="@@PLUGINFILE@@' . $filepath . $filenameimg . '"></a></p>';
              $expected = '<p><a href="files/'. $filenamepdf . '"><img src="files/' . $filenameimg . '"></a></p>';
              $output = portfolio_rewrite_pluginfile_urls($input, $context->id, $component, $filearea, $itemid, $format, $options);
              $this->assertSame($expected, $output);
       
              // Test with img in a link pointing to the image.
              $input = '<p><a href="@@PLUGINFILE@@' . $filepath . $filenameimg . '">' .
                  '<img src="@@PLUGINFILE@@' . $filepath . $filenameimg . '"></a></p>';
              $expected = '<p><a href="files/'. $filenameimg . '"><img src="files/' . $filenameimg . '"></a></p>';
              $output = portfolio_rewrite_pluginfile_urls($input, $context->id, $component, $filearea, $itemid, $format, $options);
              $this->assertSame($expected, $output);
      

      Actually, anything in a link to a file will be stripped out.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fred Frédéric Massart
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: