Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

U-SRV sending blank / broken QR codes #7

Closed
bergeronian opened this issue Mar 11, 2021 · 8 comments
Closed

U-SRV sending blank / broken QR codes #7

bergeronian opened this issue Mar 11, 2021 · 8 comments

Comments

@bergeronian
Copy link

Installation succeeds and shows a good installation of U-SRV in the YOURLS IQRPlugin Config, but the database is blank and QR codes do not appear.

@bergeronian
Copy link
Author

YOURLS 1.8, U-SRV 2.3.3, IQRPlugin 2.2.1.

If I use the mass QR check, it will create the cache files, but not update the database. I can't retrieve a QR code using the .qr URL method either.
If I try to create a new link, it does not create a cached image or update the database.
If I use the U-SRV plugin to upload a test file, it writes the cache and updates the database.

@joshp23
Copy link
Owner

joshp23 commented Mar 12, 2021

the database is blank and QR codes do not appear.

The qr codes are not put in the U-SRV database, they are stored as files in the cache folder so that much is ok. When you say that they don't appear here, what do you mean, in the file system, in the YOURLS ui, or both?

the mass QR check, it will create the cache files

After you mass check, do the qr codes appear in YOURLS share boxes?

If I try to create a new link, it does not create a cached image

Any log data, or web console output?

@bergeronian
Copy link
Author

bergeronian commented Mar 12, 2021 via email

@bergeronian
Copy link
Author

bergeronian commented Mar 12, 2021

After you mass check, do the qr codes appear in YOURLS share boxes?

No, they do not. Broken link. I think this has more to do with USRV retrieving files. When I attempt to download a file by generating my own key, I get a file but it is empty in the case of a test file made from within the USRV plugin, and a corrupt image in the case of a QR. The access.log shows a successful attempt, result code 200.

@joshp23
Copy link
Owner

joshp23 commented Mar 12, 2021

  1. If you are using NGINX, please make sure that you follow this instruction. If you are using Apache and SSL connections, try this instruction. Did you try this, did it fix the issue?
  2. Just to be clear, you can confirm the following is working
    • QR code generation when adding a new link
      Yes?
    • QR code generation when using mass check function
      Yes?
  3. You have neither been able to cause a QR Code to display in the UI where the Share Box appears, nor by using the .qr method. No errors are showing in your access.log or error.log.
    Yes?
  4. Somewhere there is a failed attempt to fetch an image. You might be able to trace this with the Web Developer Console in FIrefox or Chrome.
    a. Open up your access/error logs for YOURLS. Turn on YOURLS debug and all relevant error reporting.
    b. Open a fresh tab (clear cache, etc) and open the Web Dev Console for Firefox or Chrome.
    c. Attempt to access https://lnk.mcla.edu/nco49.qr and be mindful of the Web Dev Console output.
    d. Refresh your log files and read through the data there and the console.

In the Web Developer Console there should be 2 or 3 get requests. The first, once expanded, should show a 301 Moved Permanently status. Is that showing for you? I should change this to 302, but it is what it is for now. Anyway, the second should be the usrv link. That's what we care about. You should be getting some kind of error there. Here's an example of the output I'm looking for:

GEThttps://example.com/srv/?id=iqrcodes&key=4fca69185aec7eb983eca347f23b6a99&fn=qrc_d716aha879a3adb408di6a6873afde5d.png
[HTTP/2 200 OK 150ms]

	
GET
	
scheme
	https
host
	example.com
filename
	/srv/
id
	iqrcodes
key
	4fca69185aec7eb983eca347f23b6a99
fn
	qrc_d716aha879a3adb408di6a6873afde5d.png
Address
	[XXXX:XXXX:XXXX:XXXX::XXXX]:443
Status200
OK
VersionHTTP/2
Transferred2.14 KB (1.62 KB size)
Referrer Policyno-referrer

joshp23 referenced this issue in joshp23/YOURLS-IQRCodes Mar 12, 2021
@bergeronian
Copy link
Author

Thank you for sticking with me on this. I was getting a 200 on image load, FWIW. What I found eventually, was that the file would download successful, with two line feeds at the beginning. I couldn't find anything in srv.php that would introduce blank lines but I "solved" it by adding:

ob_clean();
flush();  

On line 159 of srv.php, just before the readfile($file).

@joshp23 joshp23 changed the title Empty U-SRV database U-SRV sending blank / broken QR codes Mar 12, 2021
@joshp23
Copy link
Owner

joshp23 commented Mar 12, 2021

Thank you for sticking with me on this.

Indeed.

I was getting a 200 on image load, FWIW.
Ok. I was wanting to explicitly rule out IQRCodes errors, and zero in on any subtle networking issues, or rule that out. So that U-SRV could be singled out, and you beat me to it.

ob_clean();
flush();  

seems like a pull request in the making. ;)

@joshp23 joshp23 transferred this issue from joshp23/YOURLS-IQRCodes Mar 12, 2021
@joshp23
Copy link
Owner

joshp23 commented Mar 12, 2021

I added your change to the main branch. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants