Impress - Duplicating master slides with a macro

Hello,
using LibO Version: 7.3.6.2 / LibreOffice Community
Build ID: c28ca90fd6e1a19e189fc16c05f8f8924961e12e
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

OS is LinuxMint 20.3 (Cinnamon)

I’d like to create a macro in Basic for Impress that would duplicate an existing masterslide. This would be a workaround to the missing “Copy” option that exists in the UI for standard slides but not for masterslides.

I found that Impress documents expose the .Duplicate() method, as documented here:
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1drawing_1_1XDrawPageDuplicator.html

where one can read:

creates a duplicate of a DrawPage or MasterPage, including the Shapes on that page and inserts it into the same model.

Unfortunately, I can’t make this method to work with master slides. Any attempt results in actually duplicating the referenced standard slide instead of the master slide. The attached demo shows the ill-behaved code TestODP_duplicates.odp (14.6 KB).

Am I missing something? Or is it a bug of sorts?

indeed, both lines copy the same (normal) slide.

ThisComponent.duplicate(ThisComponent.getDrawPages().getByIndex(0))
ThisComponent.duplicate(ThisComponent.getMasterPages().getByIndex(0))

Thanks.
I found that a bug is already opened (for the UI part). I’ve updated that 10yrs old bug, here:
https://bugs.documentfoundation.org/show_bug.cgi?id=45617