OF-DL icon indicating copy to clipboard operation
OF-DL copied to clipboard

PaidPostFileNameFormat does not work

Open fendorix opened this issue 2 years ago • 1 comments

Hi, I've been playing around with custom filename templates for the first time and noticed that PaidPostFileNameFormat does not work. You always get the default filenames instead.

The format I've used is this: "PaidPostFileNameFormat": "{mediaId}_{postedAt}",

The reason seems to be in Program.cs line 1047: Purchased.List? postInfo = purchasedPosts.PaidPostObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);

In 'postinfo' the 'fromUser' member is always null. It's like that for all entries in ' purchasedPosts.PaidPostObjects'.

For paid messages (instead of posts) it works, the 'fromUser' field is set correctly to the post author.

The reason it fails is then in DownloadHelper.cs GenerateCustomFileName line 156: if (string.IsNullOrEmpty(filenameFormat) || postInfo == null || postMedia == null) || author == null)

Since 'author' is always null, the original filename is returned. As a workaround I've removed the author null check since I don't use the author name in my template string and it works.

So my guess is, that it's not possible to use 'username' in 'PaidPostFileNameFormat'.

fendorix avatar Nov 19 '23 02:11 fendorix

It will be possible to use username but OF might of changed something so I probably need to make a code change. I know for one of them it will always return a user id in either author or fromUser which can subsequently be used to get the username from the list of subscriptions by the id. Should be something I can take a look at.

sim0n00ps avatar Nov 19 '23 02:11 sim0n00ps

Closing due to age.

melithine avatar Jul 31 '24 18:07 melithine