Download SGF doesn't work when SGF content is inline

Is something wrong? Do you have any suggestions? Let us know.
Post Reply
xela
Lives in gote
Posts: 652
Joined: Sun Feb 09, 2014 4:46 am
Rank: Australian 3 dan
GD Posts: 200
Location: Adelaide, South Australia
Has thanked: 219 times
Been thanked: 281 times

Download SGF doesn't work when SGF content is inline

Post by xela »

The "Download SGF" link in EidoGo doesn't work for the majority of posts, at least for me. My web browser will download a file, but the download only contains two characters: a newline followed by an opening parenthesis (hex 0a28).

For example, the ones on these pages don't work:
- https://lifein19x19.com/viewtopic.php?f=4&t=18724
- https://lifein19x19.com/viewtopic.php?f ... start=1820
- https://lifein19x19.com/viewtopic.php?f=4&t=18729, second post "If you present it like this, it is easier for people to review."

For comparison, these ones do work: I can click to download and open the complete SGF file:
- https://lifein19x19.com/viewtopic.php?f=18&t=17217
- https://lifein19x19.com/viewtopic.php?f=4&t=18785
- https://lifein19x19.com/viewtopic.php?f=4&t=18618

When I quote the posts (as if I were going to reply to them), I can see the difference: the working ones have the SGF uploaded as an attachment, whereas the non-working ones have the SGF code pasted inline.

Of course people are going to paste SGF code when that's easier than clicking a few more buttons to attach and reference a file. Is there a way to enable downloads for pasted SGF content?
Last edited by xela on Fri Jan 13, 2023 5:07 pm, edited 1 time in total.
xela
Lives in gote
Posts: 652
Joined: Sun Feb 09, 2014 4:46 am
Rank: Australian 3 dan
GD Posts: 200
Location: Adelaide, South Australia
Has thanked: 219 times
Been thanked: 281 times

Re: Download SGF doesn't work when SGF content is inline

Post by xela »

Bump. Anyone else having the same problem?
dfan
Gosei
Posts: 1598
Joined: Wed Apr 21, 2010 8:49 am
Rank: AGA 2k Fox 3d
GD Posts: 61
KGS: dfan
Has thanked: 891 times
Been thanked: 534 times
Contact:

Re: Download SGF doesn't work when SGF content is inline

Post by dfan »

Yes.
xela
Lives in gote
Posts: 652
Joined: Sun Feb 09, 2014 4:46 am
Rank: Australian 3 dan
GD Posts: 200
Location: Adelaide, South Australia
Has thanked: 219 times
Been thanked: 281 times

Re: Download SGF doesn't work when SGF content is inline

Post by xela »

OK, so it's not just me. Are any admins looking at this thread? Is there any hope of fixing the issue?
vier
Dies with sente
Posts: 91
Joined: Wed Oct 30, 2013 7:04 am
GD Posts: 0
Has thanked: 8 times
Been thanked: 29 times

Re: Download SGF doesn't work when SGF content is inline

Post by vier »

xela wrote:OK, so it's not just me. Are any admins looking at this thread? Is there any hope of fixing the issue?
No, it is not just you. This looks a bit like the problem reported in viewtopic.php?f=14&t=14481. The URL is terribly long and causes an error somewhere.
xela
Lives in gote
Posts: 652
Joined: Sun Feb 09, 2014 4:46 am
Rank: Australian 3 dan
GD Posts: 200
Location: Adelaide, South Australia
Has thanked: 219 times
Been thanked: 281 times

Re: Download SGF doesn't work when SGF content is inline

Post by xela »

vier wrote:This looks a bit like the problem reported in viewtopic.php?f=14&t=14481. The URL is terribly long and causes an error somewhere.
No, not the same problem. The URL in each case is just eidogo-phpbb3/iframe-player.html# and I'm not seeing any error messages. The broken ones still download *something*, just not a real SGF.
vier
Dies with sente
Posts: 91
Joined: Wed Oct 30, 2013 7:04 am
GD Posts: 0
Has thanked: 8 times
Been thanked: 29 times

Re: Download SGF doesn't work when SGF content is inline

Post by vier »

xela wrote:
vier wrote:This looks a bit like the problem reported in viewtopic.php?f=14&t=14481. The URL is terribly long and causes an error somewhere.
No, not the same problem. The URL in each case is just eidogo-phpbb3/iframe-player.html# and I'm not seeing any error messages. The broken ones still download *something*, just not a real SGF.
I did not say "the same" - mainly because I see Status 200 - but "a bit like". Somewhere the URL is too large. The URL is not what you say it is: in the first non-working example I see

Code: Select all

GET
 https://lifein19x19.com/eidogo-phpbb3/backend/fake-download.php?data=(;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] RU[Chinese]SZ[19]KM[7.50]TM[900]OT[5x30 byo-yomi]PW[Artevelde]PB[Opponent]WR[2d]DT[2022-05-06]PC[The KGS Go Server at http://www.gokgs.com/]RE[W+Resign];B[pd]BL[898.475];W[pp]WL[898.413];B[cd]BL[896.235];W[dq]WL[895.284];B[do]BL[894.685];W[co]WL[893.234];B[cn]BL[890.318];W[cp]WL[890.892];B[dn]BL[887.926];W[fq]WL[885.111];B[dj]BL[883.672];W[ed]WL[882.087];B[hd]BL[882.234];W[cc]WL[863.421];B[bc]BL[880.563];W[dc]WL[861.274];B[be]BL[879.126];W[hb]WL[857.003]C[This is not the best move but it's a good move, which is prior knowledge confirmed by AI study.];B[hc]BL[874.585]C[Here I did some reading](;W[gb]WL[781.208]C[see variations](;B[jc]BL[872.348];W[ib]WL[777.243];B[jb]BL[870.096](;W[fe]WL[750.796]LB[ic:A][cf:B]C[Here I decided against cutting because AI study showed that I often end up with heavy groups after cuttingI also decided playing away would allow Black to enclose me AND I have a follow up at B];B[je]BL[867.754];W[qn]WL[742.182]C[another decision influenced by AI study: when a first exchange seems to cool down, play in the corner diagonally opposite and/or the least disputed corner];B[qf]BL[861.008];W[cf]WL[691.366]C[executing the follow-up I had in mind now that all corners have been occupied];B[cg]BL[858.169](;W[dg]WL[683.604]C[I read the alternative and eventually chose the less sharp move];B[ch]BL[851.285];W[bf]WL[678.088]C[but now I didn't hesitate];B[df]BL[849.146];W[de]WL[669.056];B[ef]BL[845.401];W[ce]WL[665.8]C[I had read this too and thought it killed - and so it did];B[cb]BL[843.658];W[db]WL[656.76];B[ab]BL[837.611];W[ba]WL[644.351];B[ca]BL[836.175];W[ad]WL[634.537];B[ae]BL[833.319]C[being able to see this move ahead comes from doing many tsumego];W[bd]WL[632.643];B[ac]BL[831.175];W[bd]WL[630.502];B[ad]BL[829.638]C[die in gote];W[ee]WL[606.13]C[(no need for this)];B[eg]BL[827.376];W[pg]WL[576.54]C[while it's tempting to invade, the territorial advantage makes reducing a far better optionThis shoulder hit has been reinforced by AI study];B[qg]BL[825.117];W[pi]WL[571.063];B[ph]BL[822.381];W[oh]WL[568.434];B[qh]BL[820.814];W[oi]WL[566.19](;B[qj]BL[818.661]LB[pc:D][qc:E][kd:A][nd:C][nf:B][pk:F]C[Black resists and I'm thinking of a few options ](;W[pc]WL[561.697]LB[pe:A][qe:B]C[eventually I went for the attachment based on the expectation that I might get in a free atari around A];B[oc]BL[814.523];W[ob]WL[547.591];B[qc]BL[812.386];W[pb]WL[538.276]C[in fact the invasion becomes heavy this way];B[nc]BL[809.646];W[qd]WL[519.767];B[rd]BL[802.799];W[mc]WL[487.573]C[a tesuji];B[nb]BL[798.652];W[mb]WL[457.107]C[I'm shifting my attention to the aji at the top];B[md]BL[793.01]C[but this move gives me a great opportunity to simplify];W[od]WL[454.053];B[nd]BL[790.873];W[pe]WL[451.044];B[qe]BL[789.336];W[pd]WL[440.376];B[pf]BL[787.198];W[rc]WL[437.017];B[rb]BL[785.16]C[I had not expected this and needed to read my next move];W[sc]WL[392.993]C[since it works, it's my best move];B[sb]BL[782.956];W[qb]WL[389.244];B[sd]BL[781.519];W[qc]WL[381.523];B[re]BL[779.38];W[ra]WL[341.981]LB[oa:A]C[this move would have been better at A but I executed the sequence I had read];B[oa]BL[777.444];W[pa]WL[335.31];B[na]BL[776.007]C[live in sente];W[pk]WL[325.141]C[I could play at the bottom in stead of defending here];B[qk]BL[774.471];W[pl]WL[323.04];B[kq]BL[773.036];W[mq]WL[307.358];B[hq]BL[771.074];W[qq]WL[301.002]C[undoubtedly slow but very safe - I have four corners now];B[ko]BL[769.136]C[I can see a center forming and since I have no weak groups I decide making another group];W[jm]WL[267.7]LB[fe:A][oi:B][fq:C]TR[eg][fh][gi][hj][hk][il][im][jn]C[there's enough space and connection optionsI'm also thinking about this sector line];B[km]BL[767.025];W[kl]WL[260.454];B[lm]BL[765.49];W[jl]WL[236.301];B[ll]BL[761.947];W[ji]WL[230.365];B[lj]BL[760.611];W[gm]WL[201.86];B[go]BL[758.519];W[gj]WL[186.48];B[hi]BL[756.581];W[gi]WL[178.908];B[hh]BL[755.243];W[gh]WL[173.122];B[gg]BL[753.306];W[hg]WL[170.606](;B[gf]BL[750.336];W[ig]WL[167.148];B[hj]BL[748.379];W[hk]WL[163.927];B[ik]BL[746.344];W[ij]WL[159.091];B[gk]BL[742.301];W[hl]WL[156.486];B[fk]BL[740.296];W[mk]WL[119.713];B[lk]BL[738.259];W[jk]WL[113.888]C[End of comments. White is miles ahead.];B[fj]BL[732.72];W[ih]WL[110.786];B[fc]BL[730.783];W[fb]WL[107.358];B[ec]BL[729.122];W[eb]WL[104.246];B[gc]BL[725.685];W[da]WL[97.657];B[bb]BL[723.651];W[ia]WL[93.309];B[ja]BL[721.453];W[bn]WL[85.106];B[bm]BL[717.511];W[bo]WL[83.424];B[rm]BL[715.567];W[rn]WL[78.008];B[qm]BL[711.629];W[pm]WL[76.599];B[gr]BL[709.789];W[fr]WL[71.18];B[lr]BL[707.953];W[mr]WL[65.73];B[ms]BL[706.215];W[ns]WL[61.578];B[ls]BL[704.979];W[or]WL[42.991];B[bg]BL[700.94];W[af]WL[39.554];B[ag]BL[695.696];W[mo]WL[30]OW[5])(;B[ig];W[fg];B[gf];W[ff];B[eh];W[hf];B[ge];W[fh]))(;W[kd];B[ke]C[I discard the peep because I'm not sure Black will give in])(;W[qc];B[pc];W[pb];B[ob];W[rb]C[ther'e might be a ko here but ko is complexity and I don't need that])(;W[nf];B[nd]C[this feels a little too soft])(;W[nd];B[nf];W[kd];B[jd];W[pc];B[qc]LB[lf:A]C[I liked this option a lot but for some reason didn't play it]))(;B[nd];W[qi]))(;W[bf];B[df];W[de];B[ce];W[dg];B[ef];W[bg];B[ch];W[bh];B[ci];W[bb];B[bi]))(;W[qn];B[fe](;W[ee];B[fc];W[fb];B[ec];W[eb];B[dd])(;W[fd];B[ee]C[even though it's gote - with hindsight it might not have been necessary])))(;B[ib];W[jb];B[ic];W[ef]C[acceptable])(;B[fc];W[fb];B[ec];W[eb];B[dd];W[gc];B[fd];W[gd];B[fe];W[ge]C[acceptable]))(;W[ib](;B[gb];W[gc];B[fc];W[gd];B[fd];W[ge];B[fb];W[fe]C[good fro White])(;B[fc];W[gb];B[fb](;W[gc];B[fd];W[gd];B[fe];W[ge];B[ee]C[better for Black])(;W[fd];B[gc];W[kc]C[complicated]))))
xela
Lives in gote
Posts: 652
Joined: Sun Feb 09, 2014 4:46 am
Rank: Australian 3 dan
GD Posts: 200
Location: Adelaide, South Australia
Has thanked: 219 times
Been thanked: 281 times

Re: Download SGF doesn't work when SGF content is inline

Post by xela »

vier wrote: I did not say "the same" - mainly because I see Status 200 - but "a bit like". Somewhere the URL is too large. The URL is not what you say it is: in the first non-working example I see <something very long>
Interesting. It's behaving differently for you and me. Or perhaps we're using different methods to try and download it.

I'm looking at the bottom right of the Eidogo window, where it says "Download SGF". If I hover over that link, or if I right-click and choose "copy link", then Firefox shows me eidogo-phpbb3/iframe-player.html# How are you getting the long URL?

The number 200 isn't appearing on my screen -- but that's just the status code for success, not an error message, right?

In any case, it would be great if one of the site admins could take a look at it. Are there any admins viewing this thread? If so, please reply!
vier
Dies with sente
Posts: 91
Joined: Wed Oct 30, 2013 7:04 am
GD Posts: 0
Has thanked: 8 times
Been thanked: 29 times

Re: Download SGF doesn't work when SGF content is inline

Post by vier »

xela wrote:Interesting. It's behaving differently for you and me. Or perhaps we're using different methods to try and download it.

I'm looking at the bottom right of the Eidogo window, where it says "Download SGF". If I hover over that link, or if I right-click and choose "copy link", then Firefox shows me eidogo-phpbb3/iframe-player.html# How are you getting the long URL?

The number 200 isn't appearing on my screen -- but that's just the status code for success, not an error message, right?
Your URL is independent of the game and hence cannot lead to any specific game. I see the same, that is just a simplification by firefox, not the actual URL. Yes, 200 means success. And indeed, it successfully downloaded 2 bytes. One sees the actual URL used via: Switch on the "web developer tools", make sure "Network" is selected, click "Download SGF", save the 2-byte file, and see the actual URL used in the window below. Here fake-download.php just gives back its argument: visiting 'eidogo-phpbb3/backend/fake-download.php?data=(this is just a test)' gives a file with content '(this is just a test)'. It works for strings of length 32000, but returns "Request-URI Too Long" for strings of length 33000. But that is not the problem: in the above example the URL was not that long.
xela
Lives in gote
Posts: 652
Joined: Sun Feb 09, 2014 4:46 am
Rank: Australian 3 dan
GD Posts: 200
Location: Adelaide, South Australia
Has thanked: 219 times
Been thanked: 281 times

Re: Download SGF doesn't work when SGF content is inline

Post by xela »

Thanks vier. OK, now I'm seeing the same as you. By contrast, the working examples have download links similar to download/file.php?id=13452 -- i.e. the Download SGF link points to the file attachment.

Very strange. I'm looking at https://github.com/LifeIn19x19/forum/bl ... wnload.php and https://www.php.net/manual/en/function. ... es-gpc.php If "get-magic-quotes-gpc" is always returning false, then it's hard to see how the data could be getting truncated.

Let's test with a very short SGF. I'm embedding the SGF inline, so if this is consistent with the other examples, then it should also fail to download, but with a much shorter URL.



Edited to add: Indeed, the download link now is just

Code: Select all

https://lifein19x19.com/eidogo-phpbb3/backend/fake-download.php?data=(;FF[4]GM[1]SZ[19];B[pd])
, and it still just downloads the same two bytes, so I don't think it's a length issue this time round.
vier
Dies with sente
Posts: 91
Joined: Wed Oct 30, 2013 7:04 am
GD Posts: 0
Has thanked: 8 times
Been thanked: 29 times

Re: Download SGF doesn't work when SGF content is inline

Post by vier »

xela wrote:I'm looking at https://github.com/LifeIn19x19/forum/bl ... wnload.php and https://www.php.net/manual/en/function. ... es-gpc.php If "get-magic-quotes-gpc" is always returning false, then it's hard to see how the data could be getting truncated.

Let's test with a very short SGF. I'm embedding the SGF inline, so if this is consistent with the other examples, then it should also fail to download, but with a much shorter URL.

(;FF[4]GM[1]SZ[19];B[pd])

Edited to add: Indeed, the download link now is just

Code: Select all

https://lifein19x19.com/eidogo-phpbb3/backend/fake-download.php?data=(;FF[4]GM[1]SZ[19];B[pd])
, and it still just downloads the same two bytes, so I don't think it's a length issue this time round.
Good. The data is truncated at the semicolon. The sha1 sum is that of the already truncated data. Similarly, the data is truncated at an ampersand.
Why is it truncated? I suppose because ampersand and semicolon are treated as separators for query parameters.
dany
Dies with sente
Posts: 121
Joined: Fri Dec 20, 2019 2:44 am
Rank: IGS 4 dan
GD Posts: 0
Has thanked: 36 times
Been thanked: 12 times

Re: Download SGF doesn't work when SGF content is inline

Post by dany »

xela wrote:Is there a way to enable downloads for pasted SGF content?
imho, the 131-133 lines needs to be patched in iframe-player.html

to

Code: Select all

config.gameName = encodeURIComponent(sgfData)
Post Reply